By LadylexUK
I used this kode for my FPS game Wonderland Attacks. I had two different types of enemies that spawned in alternate waves.
- WHEN DO [vectorvar:spawn radius][equals][position][plus][random vector][circle][inside][radius][5]
- WHEN [countdown timer]
- …WHEN [numvar:wave][modulo][2][equal to][1] // determines whether the wave is an odd number
- …/…WHEN [global][objvar:live enemies][count][less than or equal to][1] DO [switch page][2] // the enemies added themselves to a live enemies object set when spawned, and are removed when they die. When only 1 enemy is alive the next wave starts
- …/…WHEN [else]
- …/…/…WHEN [global[[objvar:live enemies][count][less than or equal to][1] DO [switch page][3]
- WHEN [numvar:wave][equals][6] DO [deactivate brain] // this stops the spawner after a set number of waves
page 2 and 3
These pages are identical except they produce a different enemy. Change line 3.
- WHEN [page entered] DO [numvar:wave][increment by][1]
- WHEN [duration timer][5][in frames] // number of enemies you want to spawn
- …WHEN DO [objvar: enemy][equals][create][IWP:enemy1][at position][vectorvar: spawn radius]
- WHEN [countdown timer][6][in frames] DO [switch page 1] // countdown number is one more than number of enemies spawned