Phase 2: Balanced Spawning

Objective: Create balance logic for spawning collectables

For the balanced spawning, we take a look at the 8 collectables and set the value on how often they can spawn. We set this on a scale of 1 to 100 (0 to 99) and set them in order of most to least probable.

Collectables and Values

  1. Ammo: 30
  2. Tripleshot: 20
  3. Speed: 20
  4. Danger: 10
  5. EMP: 5
  6. Shield: 5
  7. Chaos: 5
  8. Health: 5

Now that the values are set the next thing is to open the SpawnManager script and within the Spawning Coroutine, change the random range from simple(0,8) to the higher value for balancing(0, 100). Notice the values are always 1 higher on integer random ranges but this will give a between 0 and 99 result. Next set a multi if else statement to account for the 8 range and change the instantiation to use the relevant integer variable.

Collectable Spawning Coroutine

In the next post, we will look at setting a single shot shield on our original enemy.

--

--

--

Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Industry Use cases of Open shift

20 Jobs + Internships Opportunities | Job Alerts | Apply Now

20 Jobs + Internships Opportunities | Job Alerts | Apply Now

It’s 2022! We’re Hiring!

Microsoft C# Func & Action Delegate Part 1

Example 1 — Func<TResult>

Python ASCII Art Generator.

Reading BigQuery table in PySpark

5 common Leetcode mistakes for Interview preparation

CHAPTER 02 - A TRIP TO OBJECTVILLE

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
Simon Leen

Simon Leen

Developer

More from Medium

Adding the speed boost powerup

Quick tip — Enabling post-processing in Unity Universal Render Pipeline

Eyesight in Unity

Unity : use Raycast for move the Player