Balancing Spawning

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:

Tasks:

  • 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.

Next Time!

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.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Christopher West

Christopher West

76 Followers

Unity Game Developer, Software Engineer, Gamer, Musician, and Father. Christopher is a creative that enjoys a challenge and loves coding.