Note About This Book: Advanced Lingo For Games was written by Gary Rosenzweig in 2000 for users of Macromedia Director 7. It is presented here for free on an as-is basis, with no updating. Most of the information and code here can be used in the most recent version of Director. The book has been reproduced from the final editing files archived in 2000, and not the final proof galleys. So some minor differences between this version and the printed version my exist. The entire contents of this book are Copyright 2000, Gary Rosenzweig. No part may be reproduced or copied without written permission. The text here is provided for individual use only.
Want to thank me for making this book available for free? Just buy Special Edition Using Macromedia Director MX and we'll call it even!

Advanced Lingo For Games
by Gary Rosenzweig


Chapter 8 Section 4

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..