Damage Cooldown on a scene timer, Good or bad idea?

So I’m using the health behaviour on my character using global variables, as you can open a new scene to buy Health and such.
I have tried to take the two main variables we will call them
(Global)Health
(Global)MaxHealth
So on my store scene I set these two variables to a certain number to increase the health.
A few things ive tried is
Setting the health points on “At the beginning of the scene”
This just causes the points to revert back when I exit the Store. But I can see my health counter flash the new number for a split second when I get back.

Second I Used “On Scene resume” Now this kind of worked, Except I would have to go into the store twice because it would only increase one variable at a time, until I left then went back the second time, so not ideal.

BUT!. I have figured out a somewhat ideal solution.
Is Using timers, Everything works hunkydory woohoo!!

and I understand That most people who would play this game can run it run it 500x at the same time without a single frame drop. But Im worrying about the little guy who has a potato. so.

Is there a way I can do this differently so it’s not tied to the frame rate, or am I just thinking of non existent problems?
Because unfortunately this is the only way I can get the variable from the store to update when returning to the main scene.

The health behavior has a built-in cool down. Is there a reason why you’re not using it? Also, why are you using both a variable and the behavior to track health?

If you need to access the health from a different scene then you can set the global variable to the current health in the same event that changes the scene. Then copy the variable back to the health behavior when the scene resumes.

1 Like

Im using the variables so I can use the health behaviour globally.

Timers in Gdevelop are performant and battle tested. Though, this depends on how you implemented. The best way to know how much this affects your game is by testing the framerate with and without the timer. FPS = 1/TimeDelta().