This is a code, but I don't know how to fix it.
/**
* A boy who is supposed to walk on a square.
*/
public class Boy extends Actor
{
private int steps;
private int edgeLength; // The length of the sides on the square
public Boy(){
steps = 0;
edgeLength = 100;
}
public void act()
{
if (steps == edgeLength){
setRotation(getRotation()+90);
}
else{
moveForward();
steps++;
}
}
public void moveForward(){
int rotation = getRotation();
if (rotation == 0){
setLocation(getX() + 1, getY());
}
else if (rotation == 90){
setLocation(getX(), getY()+1);
}
else {
setLocation(getX() - 1, getY());
}
}
}
