Enemy spawners

Various tutorials to help you create waves of enemies

There are various different requirements for an enemy spawner

  1. Numbers of enemies produced
  2. Frequency of enemies produced
  3. Type of enemies produced
  4. Trigger for the spawner to activate

Issues with spawners

If you do not set a limit on your spawner it could create so many enemies your processor will not be able to cope and the game will get slower and slower until it is unplayable. When creating a spawner, decide the maximum number of enemies you want in play at any one time. Anything over 30 is normally too many for the processor.

Simple spawner – 1-30 enemies, single wave.

Place a logic cube where you want your enemy to spawn (spawn cube) and turn the brain is active to false in Edit/Properties/Brain. Place another logic cube with a trigger zone where your player can set off the enemy spawning.

In the trigger zone cube:

WHEN [in trigger zone][Player] DO [IWP:spawn cube][brain is active][=][true]

In the spawn cube:

WHEN [duration timer][5](the number of enemies you want) DO [create][goblin](or other enemy)[at position][position]

Multiple wave spawner

This will create a wave of enemies every time all the enemies of the previous wave are dead

In the spawn cube:

WHEN [global][numvar:enemies][=][0]
…WHEN [duration timer][5](the number of enemies you want) DO [create][IWP: goblin](or other enemy)[at position][position]

In the enemy brain

WHEN [Once] DO [global][numvar:enemies][incremented by][1]
WHEN [started to][is dead] DO [global][numvar:enemies][decremented by 1]

If you want to make this a finite number of waves change to this:

WHEN [numvar:wave][<][4]
…WHEN [global][numvar:enemies][=][0]
…/…WHEN [duration timer][5](the number of enemies you want) DO [create][IWP: goblin](or other enemy)[at position][position]
…/…/…WHEN DO [numvar:wave][incremented by][1]

This will make 4 waves only

Spawner that makes sure there are always the same number of enemies in the world

enemy brain as above

In the spawn cube:

WHEN [global][numvar:enemies][<][10]
…WHEN [duration timer][1]  DO [create][IWP: goblin](or other enemy)[at position][position]

This will create a goblin only if there are less than 10 goblins in the world. So as your player kills a goblin, another will be spawned.

Multiple enemy types wave spawner

Enemy brains have kode as above

Create a random number generator on page 2 of your spawn cube

WHEN [page entered] DO [numvar:enemytype][=][random number][1][to][3][as integer]
WHEN [numvar:enemytype][=][1] DO [objvar:enemy][=][Goblin]
WHEN [numvar:enemytype][=][2] DO [objvar:enemy][=][Zombie]
WHEN [numvar:enemytype][=][3] DO [objvar:enemy][=][Wolf]

page 1

WHEN [numvar:wave][<][4]
…WHEN [global][numvar:enemies][=][0]
…/…WHEN DO [call page][2]
…/…WHEN [duration timer][5](the number of enemies you want) DO [create][objvar:enemy][at position][position]
…/…/…WHEN DO [numvar:wave][incremented by][1]

This will create 4 waves of enemies which will be random types.

 

Comments are closed.

Powered by WordPress.com.

Up ↑

%d bloggers like this: