I figured out the gravity thing but now they can't jump. Please help
int vSpeed = 0;
int accel = 0;
private int gravity;
public void act()
{
checkFalling();
fall();
gravity--;
setLocation(getX(), getY());
checkForJump();
if(Greenfoot.isKeyDown("left")) {
move(-3);
}
if(Greenfoot.isKeyDown("right")) {
move(3);
} // Add your action code here.
if(!isTouching(Wide.class))
{
vSpeed++;
}
else
vSpeed = 0;
}
public void fall()
{
setLocation(getX(), getY() + vSpeed);
}
public void checkFalling()
{
if(!isTouching(Wide.class))
{
vSpeed++;
}
else
vSpeed = 0;
}
public void jump()
{
if(Greenfoot.isKeyDown("up"))
{
vSpeed = -10;
}
}
private void checkForJump()
{
if (Greenfoot.isKeyDown("up"))
{
gravity = 20; // this will make the character jump
}
}
public void death()
{
if(!isTouching(Enemies.class))
{
Greenfoot.playSound("death.mp3");
}
}

