I want my character to jump and fall down but every time i look at a yt tutorial or one of the examples ocdes here i cant get it working. I am making a 2d fighter game for school and am a newbee to greenfoot. Could anybody give me advise on how to make my character jump. (Snelheid is dutch and it means speed)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | public class Joker extends Actor { public int snelheid = 4 ; /** * Act - do whatever the Joker wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { checkKeys(); } public void checkKeys() { if (Greenfoot.isKeyDown( "d" )) { setLocation(getX() + snelheid, getY()); } if (Greenfoot.isKeyDown( "a" )) { setLocation(getX() - snelheid, getY()); } } } |