Hardware Reference
In-Depth Information
coordinates for this position and, on the script you have been making to move
the sprite between backgrounds (refer to Figure 3-20), add the motion block go
to x:0 y:0. Replace the values with the new coordinates.
FIGURE 3-20 Adventurer script to set location on new background
Creating an Enchanted Key to Exit the Cave and
Giving Extra Health Points
Rather than making another portal sprite to move to another level or background, why
not introduce a new sprite that will behave like a magic object?
1. Using the Sprites palette, click the Choose New Sprite From File icon and select
Key1 from the hings folder. Rename the sprite by clicking in the name box
above the centre tabs and typing Key .
2. Just like the script that you created to move the Adventurer sprite to the inside
of the cave, the script required for this sprite will use the wait until touch-
ing _ conditional and a new broadcast message called new_level , only this
time the Key sprite waits until it is touched by the Adventurer sprite to trigger
the action, as shown in Figure 3-21.
3. he script will work only if you add another script to the stage so that when it
receives the new broadcast message for the new_level , it switches to the
Outside background. Click the Stage icon in the Sprites palette and follow the
steps in the preceding section (“Adding a Script to Switch the Stage”) to add a
new script that says: “When I receive new_level, switch to background Outside”.
 
Search WWH ::




Custom Search