I want my actor to go up and down. I know I must use the if and whenkeyis up ect but after that what do i do? I have tried move and turn but it doesn't work. Should I be using a specific integer?
int speed = 3; if(Greenfoot.isKeyDown("up")) setLocation(getX(), getY() - speed); if(Greenfoot.isKeyDown("down")) setLocation(getX(), getY() + speed); if(Greenfoot.isKeyDown("left")) setLocation(getX() - speed, getY()); if(Greenfoot.isKeyDown("right")) setLocation(getX() + speed, getY());