Game Development Reference
10. Add a change <enemies> by 1 block in both clone scripts, just before a clone
is destroyed. This counts all the enemies as they are killed or when they have
reached the base.
11. Also add these blocks to the blue and yellow enemies. If you forget some,
the script will never count to 35 and the player can't win. The finished game
screen script should look like the following screenshot:
Objective complete - mini debriefing
Test the game to see whether you performed all the steps correctly. Temporarily show
the enemies variable by checking the boxes to see if the couning works. Try killing all the
enemies to get to the win condiion. Also, test to see whether the enemies destroying the
base will get the game to the game-over condiion.
We created a very solid base for a Tower Defense game. This example showed how you
can make an interesing, seemingly complex game if you just take it one step at a ime.
By working on one game object, thinking about what it should be doing, how you can
achieve that, and then building the scripts, you can create stunning results without the
need to have a grand overview of the game before you start. Many games allow incremental
changes and addiions, making the game more complex and interesing with each step.
Our finished game shows a colorful parade of enemies as seen in the following screenshot.
We beter stop them from reaching their desinaion.