I need my character to acceletare before he reaches maximum speed, also I need him to stop at a wall but I still need a variable that i can call which tells me if he is touching the wall
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | public class Player extends Actor { /** * Act - do whatever the Player wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { if (Greenfoot.isKeyDown( "a" )) { setLocation(getX()- 5 , getY()); } if (Greenfoot.isKeyDown( "d" )) { setLocation(getX()+ 5 , getY()); } } } |