sometimes they land where i want them to land, sometimes they land either slightly above or below
int vSpeed = 1;
int accel = 0;
private int yPos = 0;
private float jumpTime = 0;
public void act()
{
checkFalling();
fall();
setLocation(getX(), getY());
if(Greenfoot.isKeyDown("w"))
{
setLocation(getX(), getY() -18);
}
if(Greenfoot.isKeyDown("a")) {
move(-5);
}
if(Greenfoot.isKeyDown("d")) {
move(5);
} // Add your action code here
}
public void checkFalling() //this is gravity
{
if(!isTouching(Ground.class))
{
vSpeed++;
}
else
{
vSpeed = 0;
}
}
public void fall()
{
setLocation(getX(), getY() + vSpeed);
}

