Variables exceeding their limit
Hey all!
I'm wondering if I'm doing something wrong (probably am).
I'm using integer variables to control certain things - e.g. how many power-ups you can use.
I don't want the player to have more than four power ups. So I put in a rule 'If powerups is equal to, or greater, than 4, make the powerups =4"
It seems though that on occasion, and more and more frequently, the variables *do* go above 4 for example.
Is there a rock solid way of getting a variable to stop at a certain number?
Hope that's clear?
Cheers,
QS
Oh, and apologies for all the questions lately! I wouldn't ask if I wasn't honestly stuck!
I'm wondering if I'm doing something wrong (probably am).
I'm using integer variables to control certain things - e.g. how many power-ups you can use.
I don't want the player to have more than four power ups. So I put in a rule 'If powerups is equal to, or greater, than 4, make the powerups =4"
It seems though that on occasion, and more and more frequently, the variables *do* go above 4 for example.
Is there a rock solid way of getting a variable to stop at a certain number?
Hope that's clear?
Cheers,
QS

Oh, and apologies for all the questions lately! I wouldn't ask if I wasn't honestly stuck!
Comments
var_power_up = x;
var_rock_solid = min(4, var_power_up);
does it rock?
Thanks for your input though!
Cheers,
QS