Enemy waves code |
The final code can be divided in 4 main parts: Spawn, Movement, Death and Counter.
The spawn part was already covered in this blog, the only new code block is the matinee sequence for opening a door so the enemies can go through.
The spawn part was already covered in this blog, the only new code block is the matinee sequence for opening a door so the enemies can go through.
Opening door and spawning enemy |
Next is movement; This moves the spawned enemy from the initial position to another place, avoiding a bug that prevents new bots spawning if there is a bot in the spawn point.
Enemy spawned and moving to path node |
Next is the death event, linked to the spawned enemy.
Death of the bot |
This is where the fun begins, the counter. On the top modify Object List, the Add to List node is linked to the Actor Factory that spawns the enemy and checks if the number of enemies is less or equal to the maximum amount for that wave.
The bottom one removes from the list when a bot is dead, checks if all the bots are dead, if so, it adds one enemy to the next wave, up to a max of 5, then plays an announcement saying "5 seconds until next wave".
Incrementing next enemy wave |
It is a big code, but when we break it down to smaller bits it becomes simpler to understand.
No comments :
Post a Comment