Hardware Reference
In-Depth Information
FIGURE 3-25 Completed script to control movement of right key
Creating a Game Over Screen
Typically in role-playing games, when a player loses all her health points, the game
ends and a Game Over screen is displayed. Follow these steps to create a Game Over
screen:
1. First you need to add a new Game Over background to the stage. You can either
paint a new one or duplicate one of the existing backgrounds and edit it to dis-
play Game Over across it in large letters (see Figure 3-26).
2. Next, add another script to the Adventurer sprite. Click on the sprite in the
Sprites palette, and then drag the control block when
clicked onto the
Scripts tab.
3. Add a forever control block underneath, and an if control block inside the
forever block.
4. Drag the operator block 0 < 0 inside the the if blank hexagon, Add the variable
health inside the left side of the < sign and type the value 0.1 in the right side.
5. Add the control block broadcast and create a new broadcast message called
Game Over .
he code of this script states that if the health of the Adventurer sprite is less than 0.1,
the Game Over message will be broadcast to all the sprites and the stage. You need to add
the following script to the stage to listen for this broadcast message to end the game.
When I receive 'Game Over'
Switch to background 'Game Over'
Stop All
Search WWH ::




Custom Search