Loading waves of enemies
Waves are groups of enemies that try to reach the tower to attack it at the same time and this game consists of holding off as many waves as possible.
Add the following constants to GameScene.m
, which will be helpful in this stage of development:
// Base number of enemies for each wave const int kWAVES_NUM_ENEMIES = 10; // Number of waves const int kNUM_WAVES = 10; // Waves interval const int kWAVES_INTERVAL = 24;
We are declaring constants for the number of enemies each wave will contain, the number of waves, and the time each wave will take.
Declare also the following variables:
// Declare number of wave int _waveNumber; // Label to show the wave CCLabelTTF *_waveLabel; // Declare count of enemies int _countEnemies;
We keep the wave number, which is shown in a label, and we also declare a counter to know how many enemies we have loaded so far.
In the init
method, remove this method call:
[self loadEnemy];
Add the following lines at the end:
...