in your void control every time u use the keys: up,down and left you will still run through the check right key button. And when you dont have your right key down it will update the image. thats y every time you have u go left it will change the image to the left image then imediately change to the look right image.
heres one way of doing it. All i did was add a check for when one of those 4 keys are down that goes around their seperate checks, so the first line of this code.
[code]if(Greenfoot.isKeyDown("up") || Greenfoot.isKeyDown("down") || Greenfoot.isKeyDown("left") || Greenfoot.isKeyDown("right"))
{
if (Greenfoot.isKeyDown("up"))
{
setLocation(getX(), getY() - 5);
}
if (Greenfoot.isKeyDown("down"))
{
setLocation(getX(), getY() + 5);
}
if (Greenfoot.isKeyDown("left"))
{
move(-5);
runLeft();
facing = "left";
}
if (Greenfoot.isKeyDown("right"))
{
move(5);
runRight();
facing = "right";
}
}
else
{
updateImage();
}[/code]
2012/10/10
2012/10/10
2012/10/11