public class AllyAnt extends Actor
{
public void act()
{
clickToMove();
move(1);
}
public void clickToMove()
{
// it moves in the general directions of where i click, by only following on the x and y axes and their diagonals, yet the sprite of the actor does turn to where it SHOULD move... please any help would be appreciated :)
if(Greenfoot.mouseClicked(null))
{
MouseInfo mouse = Greenfoot.getMouseInfo();
int MouseX = mouse.getX();
int MouseY = mouse.getY();
int targetX = MouseX - getX();
int targetY = MouseY - getY();
double angle = Math.toDegrees(Math.atan2(targetY,targetX));
int direction = (int)angle;
setRotation(direction);
}
}
}

