Game Development Reference
In-Depth Information
Click on the checkboxes in front of the new variables to make them visible on
the stage. This way we can keep track of our scores.
At the start of the game, we set the values of these variables to 0 as shown in
the following screenshot. The best place to do this is inside the stage object.
Next, we will add a point to the correct variable when an enemy is defeated.
We already built a script to check when an enemy is touched by a spear sprite.
Just before we delete this clone, we only need to change the correct variable by 1
point in the change <scoreRed> by () block as shown in the following screenshot:
It should be obvious that the scoreRed variable is meant for a red starfish. For the other
two colors, we would use scoreBlue and scoreYellow variables respecively.
Search WWH ::

Custom Search