Closed parkm closed 10 years ago
Hmm, this is a predicament. Here's a snippet of how it works currently:
var chance = randomInt(0, 100);
if (chance <= this.fireConfig.applyChance) {
So, applyChance is an int from 0 to 100 in terms of percentage. We can do this differently, but we have a few options. I'm thinking instead of generating a randomInt, we can generate a random float rounded to the nearest x decim. places, but how much precision do we really need?
Yeah random float should work. I think two decimal places should be enough but we don't really need to round it off.
We check for fire spread each frame so we really need small percentages, but it only really works with integers.