Yeah, it makes sense, I did help you out with your hp system before. Essentially the code I gave is a way of limiting, while increasing any number. So whenever you increase a variable, you can use that to limit it.
- Code: Select all
variable+=10; // this is the normal way to increase variable by 10
variable = min(variable+10, 100); // this way increases variable by 10, but limits it to a max of 100
Now if you need to use a variable in an array, just replace that. But anyways, whenever you increase the variable you don't want to have exceed 100, use that code and it will never exceed 100.