Help, I have a homework in school to make my actor move up, down, left and right. I have been trying codes of mirroring the image and changing the X and Y coordinates, and so far I have 2 problems: 1) I do not want my actor to move Northeast/Northwest, Southeast/Southwest, but it keeps on moving that way whenever I press the up/down key; 2) My actor keeps on flipping when I press the up/down/left/right, even if I have the getImage().mirrorHorizontally/Vertically() code. How do I solve this problem? Can anyone help me? Thanks. :) (Here's my code, btw if you need it)
if (Greenfoot.isKeyDown("right"))
{
getImage().mirrorHorizontally();
setLocation(getX()+1, getY());
move(1);
}
if (Greenfoot.isKeyDown("left"))
{
setLocation(getX()-1, getY());
move(-1);
}
if (Greenfoot.isKeyDown("up"))
{
getImage().mirrorVertically();
setLocation(getX(), getY()-1);
move(1);
}
if (Greenfoot.isKeyDown("down"))
{
getImage().mirrorVertically();
setLocation(getX(), getY()+1);
move(-1);
}
