Game Development Reference
In-Depth Information
Collecting bugs
Now that you know how to use arrays, let's collect some bugs!
1. Create a dynamic text field named ejopnq_pekjo to display the game's instructions.
2. Create some boxes to visually display the bugs you collect. Give the boxes these instance
names: epai>kt,, epai>kt-, and epai>kt..
3. Add a ikqoa object to the stage. The mouse doesn't actually do anything in the game; it's
added as an obstacle for the player. If the player collects the mouse, the game is lost. The frog
doesn't like mice! Figure 9-25 shows what these new objects look like.
4. Save the ^qc?]p_dan*bh] file.
Figure 9-25. Add the instructions dynamic text field, item boxes, and mouse.
5. You need to declare an array to collect the bugs and a variable to tell you whether the mouse
has been collected. Add the following declarations at the top of the class definition:
6. Initialize the array, variable, and dynamic text field in the constructor method:
Search Nedrilad ::

Custom Search