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); } } }
![Twitter](/assets/twitter-4e19209ef84344ee0c433f4c7bad8d49.png)
![Twitter.hover](/assets/twitter.hover-1fb19a5bafc50deace8f88eaec867845.png)