User Guide

127
and then add the following blocks as the first blocks inside the
forever loop:
To finish the scripts for the Williams1 sprite, click it on the Stage.
Then, duplicate the whole script that begins with when Z key
pressed and make the following changes:
1. Change when Z key pressed to when X key pressed.
2. Change the switch to costume Williams-6 blocks to
switch to costume Williams-7.
3. Change the change by Hits by -1 blocks to change
by Hits by -2.
4. Change the if costume # = 6 block to 7.
5. Add a wait 0.1 secs block to the top of the script.
Hitting the Player
When the Billy sprite is hit, the variable Health must be
decremented. When it reaches zero, the sprite is knocked back
50 steps. However, this could cause the player to be knocked off
the screen, and the ghost sprite would be in the wrong position.
To fix this, the spawn point that triggers the enemies declares an
x and y position on the Stage that is safe for the player. When
they lose a life, a script tells the ghost sprite to move to this safe
location. The ghost sprite then tells the Billy sprite to update its
position.
Two new variables are needed for this: RespawnX and
RespawnY. Create them on the Stage so that all sprites can see
the values. The spawn points must set these variables:
1. In the Sprite List, click Spawn1.