|
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
Using the behaviors described previously to create this game is fairly simple. First, you need to create the "Cards" cast. Figure out how many cards you want, remembering that each card will be used twice to make a matching pair. Then, create your bitmaps. The "Cards" cast should look like Figure 4.2, shown previously. There should be nothing but face-up cards in the cast. The face-down card needs to be placed in another cast library, probably just the default internal cast. Make sure that the cards, and the face-down bitmap, are all exactly the same size. Next, you need to place the face-down bitmap in the Score twice for every card you have. So if the "Cards" cast has 18 cards, then you need to make 36 sprites. These sprites should be in a continuous sprite block. It's best not to start the sprite block at sprite 1, because you may want to place a background image there. I usually put something like this starting at sprite 11, which gives me 10 sprites that will be underneath them if I need them. Select all the card sprites and add the simple "Matching Game Sprite Behavior" to them. This allows them to pass the mouse clicks back to the main behavior, which will be in the frame script channel. Drop the "Matching Game Frame Behavior" there. When you drop the "Matching Game Frame Behavior", you are asked to fill out the Parameters dialog box for this behavior. This dialog box was shown in Figure 4.3. Start by indicating the sprite offset for the block of card sprites. If the block starts at sprite 11, for instance, then the offset is 10. You can also modify the delay time for cards to be shown, and the sounds that are played at various points of the game. If you don't have a sound for a particular event, just leave it empty. Finally, tell the behavior which frame it should go to when the game is over. In many cases, just using the default "next" setting works fine. That's all you need to do to get a game going. However, there are many ways in which this game can be improved beyond the basics. | |