Catching Game Stage 3 – Collision Detection

{loadposition adposition4}

Stage 3 – Collision Detection

In the previous stages of game development, we created a catching character that moves based keyboard controls. We created falling objects that are placed on the stage dynamically with Actiosncript code, are placed in random places on the x axis, and fall at random speeds along the y axis.

{loadposition adposition5}Now, in this stage, we need to create the collision detection Actiosncript game code which will enable our catching character to catch the falling objects when he gets close enough to them to cause a collision. To do this we will run a constantly repeating test (polling) that will compare the x and y position of the falling objects to the x and y position of the catching character. 

I have created video tutorials below that explain the Actionscript collision detection code and process in detail.

Video Tutorials


 In part 7, I add that code that will compare the x and y positions of the moviecips to detect a collision.

 In part 8, a successful collision increases the game score and also activates a sound effect.


{loadposition adposition4}

Older Video Tutorials

The video tutorials below were created with an earlier version of Flash and Actionscript 2. The videos are still good and Parts 1 and 2 cover how to use the Flash hitTest function (not covered above) as an alternative for the collision detection. Also included below, is how to add a Flash pre-loader at the beginning of your catching game


Author: Dan

Dan teaches computer networking and security classes at Central Oregon Community College.

Leave a Reply

Your email address will not be published.