In the last article, I implemented new enemy types for the player to contend with. Today, I’m going to be continuing the second, and final, phase of the GameDevHQ 2D Game Development Certification track. In this article, I’ll be implementing balanced spawning between enemies and powerups! The requirement reads as follows:
- Create a balanced spawning system between Enemies & pickups
- Pickups like Health should be rare, where Ammo is frequent
To balance my spawning of powerups I added a new property to the powerup script and made it editable so that each powerup can have it’s weighting adjusted in the editor.
With this new weight property in place I set the weighting on each powerup prefab. Next I modified the Spawn Manager to read in all of the powerup weights and store them. this required a new class for storing the weight and the powerup type to be stored in a table.
I then modified the selection of powerups on spawn to include the new weighting.
In this article, I implemented balanced spawning between enemies and powerups. Next time, I'll be adding enemy shields! If you enjoyed this article, or want to come along with me as I progress on my journey, follow me at gamedevchris.medium.com.