DemoProductions / shmup

3 stars 2 forks source link

Set max times a wave can spawn #112

Closed flip40 closed 8 years ago

flip40 commented 8 years ago

Allow waves to only spawn a maximum number of times per level. With random wave spawning, we don't want to have levels consist entirely of the same wave if luck is bad.

see #79 discussions.

ghost commented 8 years ago

Created an array to keep track of the number of times a wave instantiated. Get a random wave index, if that wave index is one that cannot be instantiated anymore, add 1 to that index (or start from 0 if at the end of the array).

Within a level, if the number of waves to instantiate divided by the maximum times a wave can instantiate is less than the number of types of waves to instantiate, then the parameters set in the level would break things. Maybe can limit the values of the variables numWaves and maxTimesAWaveCanInstantiate so that this does not happen. At the moment, I just put a debug log message for when this happens. Or give some type of message in the level editor

Cases