Catching Game Stage 2 – The Falling Objects

{loadposition adposition4}

Stage 2 – The Falling Objects

Now that the catching character can move back and forth using key presses, it is time to create the falling objects. The falling objects can be contained in a single Flash movieclip. You can draw vector graphics for the falling object using Flash, or you can import graphics created in another program. {loadposition adposition5}If you have a creative concept, idea, or theme for your game, creating the graphics will be easier. Your game can have objects to catch which earn the player points, and objects to avoid which will cause the player to lose points.

Attaching Movieclips from the Library

Flash has a built-in actionscript function that allows you to attach movieclips from the library to the stage dynamically. In order to do this the movieclip needs to have a linkage identifier name configured. You do this by right+clicking the movieclip in the library, going to properties, and under advanced settings, checkmark export for actionscript and export in first frame and then fill in an identifier name with no spaces and save. Now the movieclip can be called from the library with actionscript.  

In the video tutorials below, I cover how to dynamically attach objects from the library, place them in random locations, and move them at random speeds.

Video Tutorials

Follow along with the video tutorials and download this Flash file:

In part 4, I show how to set the movieclip linkage identifier, and attach a movieclip from the library.

In part 5, I show how to use the setInterval() function to attach movieclips from the library on a timer, and place them
in random locations using random numbers created with the Math.random(), Math class and method. 

In part 6, I show to combine Stage 1: the catcher, and Stage 2: the falling objects into one file.


Click here to go to Part 3 >>


Author: Dan

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

Leave a Reply

Your email address will not be published.