Hey guys, Im trying to switch between a series of images to show someone walking. I have the pictures, and they are in Libraries > Pictures, and are named Front, Back, Left, and Right, and are numbered from 1-9 as in Front1, Front2, etc.. The code so far that I have is:
I have tried some things that have already been discussed on this website about image switching, but an error message always comes up. Any help or suggestions are very appreciated. Thanks!
public class Person extends Actor { public void act() { move(); } public void move() { int y = getY(); int x = getX(); if (Greenfoot.isKeyDown("up")) { setLocation(x, y-3); } if (Greenfoot.isKeyDown("down")) { setLocation(x, y+3); } if (Greenfoot.isKeyDown("left")) { setLocation(x-3, y); } if (Greenfoot.isKeyDown("right")) { setLocation(x+3, y); } } }