With the Gravity the Actor should move just on an objekt under him.
How to make that?
public boolean onGround()
{
Object under = getOneObjectAtOffset(0, getImage().getHeight()/2 + 2, Ground.class);
return under != null;
}public void fall()
{
setLocation (getX(), getY() + vSpeed);
vSpeed += acceleration;
}
public void checkFall()
{
if (onGround()) {
vSpeed = 0;
}
else {
fall();
}
}