Spawning more enemies during gameplay
Now that we are able to destroy enemies, we need to again ramp up the difficulty for the player. To do so, we are going to spawn new enemies in the level as the player is playing the game. In this way, the game can continue if the player destroys the first few enemies, and if they are too slow to defeat enemies, the difficulty will gradually increase.
Choosing a spawn point where enemies will appear
First, we must decide where our enemies will be spawning in the level. We will be spawning enemies in random spots within a circular distance from an object placed in the level. Return to the level editor by clicking on the FirstPersonExampleMap tab. Find the PatrolPoint1 object in the World Outliner panel. Duplicate the object by right-clicking on it, selecting Edit, and then selecting Duplicate. Rename the new object to SpawnPoint
. Move the SpawnPoint object close to the center of your level, ensuring that it is located a bit off the ground in a player- and...