Game Development Reference
12. Then add a go to front block to make sure the base is the topmost sprite. This way,
enemies will disappear underneath the base making it look like they are entering.
Have a look at the scripts for the base sprite shown as follows:
Almost done, but there is one more thing to do. The base is waiing for the message
"reached base", but no one is sending it. Let's fix that by following the steps given:
1. Click on the red enemy to see its script.
2. At the end of the clone movement, after the last glide block, add broadcast
<reached base> . Now the base will receive this message when an enemy has
finished its move.
Do the same for the blue and yellow enemies.
Objective complete - mini debriefing
As always, we added a feature so we save our work and test to see whether it all
We now have a decent horde of enemies threatening our base. There is sill one problem
though. The player can place cannons at their leisure. So they can quickly build up an
impenetrable barrage of arillery. No horde could survive that onslaught.
To really make a challenging game, we have to limit the player's opions a litle. To do that,
we will script a resource system. The player will start the game with some "credits" to build
a few cannons with. When the funds are depleted, they can't build anymore. Killing enemies
will gain the player some more credits and allow them to increase their arillery batery.
The following are the steps to create the credits:
First create a new variable called funds . This will count your credit pool.
Then click on the Sounds tab to add a sound effect.