Hey Community!
I'm working on an RPG game atm, and i want the actor to move to the mouse clicked position. Sometimes it works fine, but sometimes he stops before reaching the target or he can't move after reaching the target. This is my code so far, hope you could help me.
cya
DMKxD
Screenshot:

private void Steuerung() { if (status == STATUS_NORMAL) { if (Greenfoot.mouseClicked(null)) { zielX = 0; zielY = 0; NeuesZiel(); status = STATUS_BEWGUNG; } } else if (status == STATUS_BEWGUNG) { Bewegung(); } if(Greenfoot.mouseClicked(Bots.class)) { angreifen = true; } else { angreifen = false; } } public void NeuesZiel() { MouseInfo mouse = Greenfoot.getMouseInfo(); zielX = mouse.getX(); zielY = mouse.getY(); } public void Bewegung() { if (zielY != getY() && zielX != getY()) { setRotation((int)(180*Math.atan2(zielY-getY(),zielX-getX())/Math.PI)); move(3); } else { status = STATUS_NORMAL; } }
