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)
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());
}
}
}
