I have been looking around for awhile but I'm not making sense of it. When I use the index I can't find the "applyGravity" code.
// with a class constant public static final int GRAVITY = 1; // gravity constant // and instance field private int vSpeed; // for current vertical speed // then, in act or method it calls vSpeed = vSpeed + GRAVITY; // apply gravity setLocation(getX(), getY()+vSpeed); // move vertically
if (!getIntersectingObjects(platform.class).isEmpty())
{
move(0);
}int dir = (int)Math.signum(vSpeed); // 1, 0 or -1 (direction of vertical movement)
while(isTouching(platform.class))
{
setLocation(getX(), getY()-dir); // edging back off the platform
vSpeed = 0; // kill speed on hitting a platform
}