I'm having difficulty using the keyboard to move an actor one square at a time. At the moment it responds to the keyboard input fine but jumps several cells in the process. My code for this actor is:
How can I fix it so that it only moves one cell at a time?
Thanks!
public void act()
{
if(Greenfoot.isKeyDown("up")){
setLocation(getX(), getY() - 2);
}
if(Greenfoot.isKeyDown("down")){
setLocation(getX(), getY() + 2);
}
if(Greenfoot.isKeyDown("left")){
setLocation(getX() - 2, getY());
}
if(Greenfoot.isKeyDown("right")){
setLocation(getX() + 2, getY());
}
}

