how do i make my actor move up or down by pressing the up and down key with the code keypress???????
//you need to call this method from the act method of your class;
public void move() {
if (Greenfoot.isKeyDown("up")) {
setLocation(getX(), getY() - 1);
}
if (Greenfoot.isKeyDown("down")) {
setLocation(getX(), getY() + 1);
}
if (Greenfoot.isKeyDown("left")) {
setLocation(getX() - 1, getY());
}
if (Greenfoot.isKeyDown("right")) {
setLocation(getX() + 1, getY());
}
}