Gravity
Alternative content
Source code
The program is written in ActionScript which compiles to Flash.
There are four classes:
- Main.as
Sets up the program, controls keyboard input, does graphics for explosion.
- Ball.as
Does physics of the ball, controls gravity, and bouncing against walls which loose a perportion of the energy.
- Target.as
Collision detection when the ball hits the target. A rectangle with the balls current and previous positions
as corners is used to detect hitting the point.
- Grid.as
Simple class just to display the background.
The code was created using the open source FlashDevelop IDE
and the open source Adobe Flex SDK.
Code inspired by BlockGame of Chris DeLeon www.GameDevLessons.com.
Creative Commons image from flickr.
Readers comments
Add a comment/link:
Msqli defined