Spawning cube with waves

By LadylexUK

I used this kode for my FPS game Wonderland Attacks. I had two different types of enemies that spawned in alternate waves.

  1. WHEN DO [vectorvar:spawn radius][equals][position][plus][random vector][circle][inside][radius][5]
  2. WHEN [countdown timer]
  3. …WHEN [numvar:wave][modulo][2][equal to][1] // determines whether the wave is an odd number
  4. …/…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
  5. …/…WHEN [else]
  6. …/…/…WHEN [global[[objvar:live enemies][count][less than or equal to][1] DO [switch page][3]
  7. 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.

  1. WHEN [page entered] DO [numvar:wave][increment by][1]
  2. WHEN [duration timer][5][in frames] // number of enemies you want to spawn
  3. …WHEN DO [objvar: enemy][equals][create][IWP:enemy1][at position][vectorvar: spawn radius]
  4. WHEN [countdown timer][6][in frames] DO [switch page 1] // countdown number is one more than number of enemies spawned


Comments are closed.

Website Powered by

Up ↑

%d bloggers like this: