Name: __________________________________________
Copyright
by
The
Goodheart-Willcox
Co.,
Inc.
Lesson 10 The Key to Adventure—Beta 163
50. Check the Self radio button.
51. In the Variable: text box, enter VAR_One_Stick. Remember, when you later reference
this variable, it must be spelled exactly the same.
52. Enter 0 in the Value: text box.
53. Click the OK button to save the action.
This programming sets the number of dynamite sticks the player has to zero. The player
will begin with no dynamite and will need to pick up one stick at a time. Next, the avatar needs
to be programmed to pick up a stick of dynamite.
54. Add an event for colliding with the avatar. Even though the dynamite pack will not be
moving, a collision with the avatar occurs when the avatar runs into the dynamite pack.
55. Drag the Set Variable button from the Control tab and drop it into the Actions:
column.
56. Check the Self radio button.
57. In the Variable: text box, enter VAR_One_Stick. This variable must be spelled exactly
the same as it was earlier.
58. Enter 1 in the Value: text box.
59. Click the OK button to save the action.
This programming allows the player to pick up one stick of dynamite when the avatar
touches the dynamite pack. Now, you need to reprogram how the player can place the sticks
of dynamite. Here, the computer needs to check to see if the avatar is currently carrying a stick
of dynamite. If so, then a stick of dynamite can be placed when the space bar is pressed. If the
avatar is not carrying a stick of dynamite, nothing happens when the space bar is pressed.
60. Add an event for pressing the space bar.
61. Drag the Test Variable button from the Control tab and drop it into the Actions:
column. The Test Variable dialog box is displayed, Figure 10-8.
62. Click the Self radio button.
63. Enter VAR_One_Stick in the Variable: text box. Be sure it is spelled exactly the same as
it was earlier.
Variable name
Player will start
with zero sticks of
dynamite
Figure 10-7
Set
Variable
Test
Variable