Game Development Reference
In-Depth Information
We will make use of the
changePoints
funcion in the
startGame
listener as follows:
1. We will expand this script with a
forever
loop.
2. In this loop, place an
if () then
statement.
3. Check if the cat touches the explosion by seing the
if touching <explosion> ? then
block.
4. If it does, set the
changePoints (-10)
block. This is where we tell the funcion the
number it should use.
5. Ater the funcion has completed, the cat will say
Ouch! That hurt. Let's try again.
in
say () for (2) secs
block.
6.
Then, we will call the
indStartPosiion
funcion block to reset the cat to its
staring posiion:
A nice addiion is to not only deduct points when the cat gets hit but also to pay a price
when placing a bomb. That way the player can't place ininite bombs and blow up the enire
level. Perform the following steps:
1.
First drag the
define changePoints
script to the
bomb
sprite to make a copy
there. Unfortunately, the Scratch funcions aren't universal across all sprites.
2.
Switch to the
bomb
sprite to add some blocks there to use the
changePoints
funcion.