Limiting resources
We now have a decent horde of enemies threatening our base. There is still one problem though. The player can place cannons at their leisure. So they can quickly build up an impenetrable barrage of artillery. No horde could survive that onslaught.
Engage thrusters
To really make a challenging game, we have to limit the player's options a little. 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 artillery battery. 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.
Click on the choose sound from library icon and select the pop sound.
Click on OK to add it to the available sounds for the project.
In the stage sprite script, after emptying...