Additional exercises – Sharpening the axe
- Enemies get spawned at a slow, fixed rate. This can get a little boring because the difficulty never really increases. Make it so that enemies get spawned faster and faster after every round. For a simple way of doing this, you could follow the next steps:
- Add
start_interval
,end_interval
, andtime_delta
as export variables to theEntitySpawner
node. Thestart_interval
variable will be the time we use between spawning entities at the start of the game,end_interval
will be the final value, andtime_delta
is the increment at which we will go from thestart_interval
variable to theend_interval
variable:
- Add
Figure 10.54 – The new exported variables for the EntitySpawner node
- Now, track in a separate variable,
_current_spawn_interval
, the time for the next enemy to spawn. Set_current_spawn_interval
equal to thestart_interval
variable at the start of the game. This variable replaces the old...