How do I check if a value (say of a global variable) is a multiple of a particular number?
For example, I'd like after every 5 turns for the game to give the player extra lives etc.
I'm thinking : compare if the global variable divided by 5 is equal to an integer, then add 1 life. But how do I write this as an expression?
Thanks for any suggestions!
Create a global variable called Turns
At the end of each turn add 1
Compare global Variable Turns = 5 then add 1 life, and set global variable to 0
Develop games in your browser. Powerful, performant & highly capable.
Thank you so much- I love the simplicity of your solution!
Simple is always better
if turns % 5 = 0