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.

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