DemoProductions / shmup

3 stars 2 forks source link

Randomize waves division by zero #123

Open ghost opened 7 years ago

ghost commented 7 years ago

Each level contains numWaves and maxTimesAWaveCanInstantiate. The numWaves variable determines the number of waves in a particular level (not the number of type of waves, may need a better variable name for this). Currently checking whether wave related variables are 'sensibly' set by the line: level.numWaves / level.maxTimesAWaveCanInstantiate > level.waves.Length If the statement above evaluates to true, then there is something wrong. See #112.

Add a check to see if maxTimesAWaveCanInstantiate is <= 0. Decide on default values for numWaves and maxTimesAWaveCanInstantiate.

flip40 commented 7 years ago

Not sure if implementation would be easy with the current set up, but could we have the case of maxTimesAWave... = 0 to skip the check entirely (effectively making 0 equal to infinite times)?

ghost commented 7 years ago

That can be confusing for the person editing the level though. But if 0 is the default value for maxTimesAWave, then maybe we can leave a note in the editor somewhere specifying that 0 would be infinite?

flip40 commented 7 years ago

We could perhaps use a slider or one of the other editor inputs to force a range of values (disallow 0 or other bad numbers, like negative)? But yeah, I could see that that might be confusing to have 0 work as infinite number of spawns.