User Guide

110
the background to scroll. These limitations are addressed in
section 5.4 Collision Detection on page111.
Adding Variables for Health, Lives Remaining, and the
Player’s Score
Since the Billy sprite represents the player in the game, now is a
good time to create three variables that are needed for the
game to work: Health, Lives, and Score.
Add these three variables and select the For all sprites option so
that all sprites can see and modify the variables.
Health should never be displayed on the Stage. Lives and Score
should be displayed on the Stage when the level starts, but not
on the title screen. So:
1. In the Sprite List, click Stage.
2. In the Blocks Palette, click Variables, and then
drag a hide variable block over to the Scripts Area
and snap it into position underneath the stop all
sounds block.
1
3. On the hide variable block, click the down arrow
and then click Lives.
4. From the Blocks Palette, drag a hide variable
block over to the Scripts Area and snap it into
position underneath the previous block.
5. On the hide variable block, click the down arrow
and then click Score.
Then add three set variable to blocks below the hide variable
blocks that you have created. Use the first to set CanScroll to 1,
the second to set Health to 5, and the third to set Lives to 3. Then
1. From the Blocks Palette, drag a show variable
block over to the Scripts Area and snap it into
1. If you do not have a “stop all sounds” block because you did not add back-
ground music, snap it to the bottom of the “broadcast StartGame” block.