For the time beeing I’m using scene variables to handle my player’s spells cooldown.
For exemple :
Add 1 to fireballCD every frame
IF fireballCD >=fireballCDreached (180) create fireball and set fireballCD to 0.
It’s working fine and launch a fireball every 3 seconds or do.
But as my players gets a lot of spell i would like to be able to handle all the cooldowns with a single event. Maybe something with structure variable but i don’t know how.
I would like to increment all spellCD variables at once and compare them with spellCDreached variables
Is it possible
Maybe you’re looking for this:
Using a structure type variable would be better for this. Or alternatively you could create several timers in your code where the Spells are handled. Right now if you have it adding one per frame and it’s not multiplied by time Delta then if the game is running on someone’s computer faster the Spells will happen more frequently if you still want to put time in that way you’ll have to multiply it by time Delta. Look up tutorials for using timers just remember you have to initialize them first so perhaps at the beginning of your scene start the timers and immediately pause them in the same action. Then after a player presses of corresponding button to use a spell to start the timer again and once it’s reached the point that the cool down is for pause the timer and reset it.