Falling Balls
written by Mark Overmars

Goal
This demonstration shows a collection of falling balls. It is an example of how gravity can be created. It also shows how fast Game Maker can be. Press <Space> to restart.

Design
To create gravity, we increase the vertical speed in every step by a small amount. When the ball hits the bottom wall, we set the vertical speed to -vspeed*0.9. As a result the direction changes (the speed becomes negative) and becomes slightly less such that the motion become slower with each bounce. Note that also a keyboard event is given for the <Space> key to reset the game.