I'm trying to make a man class jump, then fall back to the original place. I am sure this is a fairly simple solution, but I just can't grasp it right now. Here is the code:
public class Man extends Actor
{
public void move()
{
if(Greenfoot.isKeyDown("a"))
{
left();
}
if(Greenfoot.isKeyDown("d"))
{
right();
}
if(Greenfoot.isKeyDown("up"))
{
jump();
}
}
public void left()
{
turn(-1);
}
public void right()
{
turn(1);
}
public void jump()
{
setLocation(getX(), getY() - 4);
}
/**
* Act - do whatever the Man wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
move();
}
}

