My current code
if (Greenfoot.isKeyDown("right"))
{
move(1);
}
else if (Greenfoot.isKeyDown("left"))
{
move(-1);
}
else if (Greenfoot.isKeyDown("up"))
{
setLocation(getX(), getY()-1);
}
else if (Greenfoot.isKeyDown("down"))
{
setLocation(getX(), getY()+1);
}
How do i integrate a different image for each movement?
I have four images in the Images file
Left = left.png
Right= right.png
Up= back.png
Down= Person2.png
Thank you for help!