|
Want to thank me for making this book available for free? Just buy Special Edition Using Macromedia Director MX
Advanced Lingo For Games
| |
| Putting It All Together
The way the example code is set up, the game requires two cast libraries. The first is the standard internal cast, which needs to have the behavior itself, and also the "glove" bitmap, or whatever you are using to catch the falling objects. The second cast should have only bitmaps that represent the falling objects. They should all be called "good" or "bad", depending on the type of object. You could also change the code to see if the name of the members contain "good" or "bad". This way, you could name the bitmaps with little descriptions, like "baseball good" and "football bad." To build the game from these members, just drag a few objects to the Stage in a range of sprite channels. For instance, you could use channels 11 through 20. Make sure that the sprites are positioned above the top of the screen, so they are not seen until they are used by the behavior. You can use any member you want for these, because the member is set randomly before each falls. Also, you must place the glove bitmap in a sprite channel. Then, when you assign the game behavior to the script channel, you need to specify the object sprite range and the glove's sprite. The rest of the behavior's properties also need to be set. Don't forget to set the movie tempo, or perhaps the tempo channel of that particular frame as well. Taking a look at the example movie on the CD-ROM will show you how the Score and Stage are set up. Figure 8.3 shows the Score. In this example, I use various types of sports objects. However, only the baseball is a "good" object, as specified by its name in the Cast.
Figure 8.3
The Score window show the three frames used in the Falling Objects game. Game play takes place on the middle frame where there is a bank of sprites available to become falling objects..
| |