Hello, i am making a game where you can finish a track with a car. but i dont know how i can let the car move. (up down left and right) Can someone help me with this?


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | if (Greenfoot.isKeyDown( "right" )) { move( 3 ); } if (Greenfoot.isKeyDown( "left" )) { move(- 3 ); } if (Greenfoot.isKeyDown( "up" )) { setLocation(getX(), getY() - 3 ); } if (Greenfoot.isKeyDown( "down" )) { setLocation(getX(), getY() + 3 ); } |