Skip to content

Spawner

Theodore Kim edited this page Oct 19, 2023 · 6 revisions

Overview

The Spawner is used to allow the game dev to place an enemy spawners anywhere on the map. The spawner gives the game dev the options to choose the type of enemy to spawn and the difficulty of the game by adjusting the amount of enemies to spawn on each wave.

The spawner can be further configured to adjust the wave delay and the spawn rate for further freedom in adjustments.

Implementation

The spawner entity is created like any other structural entity in the StructureFactory. The entity is created with a component called SpawnerComponent, which allows the component to access the game time and update the spawner by placing the enemy onto the gameArea via the ServiceLocator.

To adjust the amount of enemies to spawn, it is required to change the quantities in the spawner.json file on each level config, where each wave has three spawning types. The spawner will spawn these enemies in the order of the numbers in the json list every tick rate. An example of the json file can be seen below: image

Usage

The contents of the spawner can only be changed in the spawner component. So to change the types of enemies and spawn delays it will have to be changed in the initialisation in the SpawnerComponent class.

Future development

For future development past Sprint 4, the Spawner could be extended so that an arbitrary number of waves and types of enemies could be summoned as wished. More than 3 types of enemies would be able to be spawned within a single waves, and waves could surpass 3 waves, perhaps extend to 10 waves. Durations of waves could be increased or decreased depending on what the developer requires, to change the pacing of the game.

Clone this wiki locally