hey i am a beginner and im trying to learn how to put gravity on my dragon so that he can walk on plateforms
private int ySpeed;
public void act()
{
ySpeed++;
setLocation(getX(), getY()+ySpeed);Actor platforrm = getOneIntersectingObject(Platform.class);
if (platform != null)
{
int dir = (int)Math.signum(ySpeed); // to determine vertical direction (landing on "feet" or head-hit)
int myHeight = getImage().getHeight);
int platformHeight = platform.getImage().getHeight();
setLocation(getX(), platform.getY()-dir*(myHeight+platformHeight)/2);
ySpeed = 0;
}