Is there a way to make an actor move left-right up-down regardless of which direction they are facing, eg if the mouse is facing north east if i press "w" the character will still travel north? Any help is appreciated.
public void move()
{
int dx = 0, dy = 0; // to hold user instructions
if (Greenfoot.isKeyDown("w")) dy--;
if (Greenfoot.isKeyDown("a")) dx--;
if (Greenfoot.isKeyDown("s")) dy++;
if (Greenfoot.isKeyDown("d")) dx++;
if (dx*dy != 0 || dx+dy == 0) return; // remove this line for 8-way movement
setLocation(getX()+dx, getY()+dy);
// check for intersections and reverse move if needed
}setLocation(getX()+2*dx, getY()+2*dy);