Watch the bouncing ball animation See how my version of gravity works inside if you need a place to start on your code.