Instead a GD timer, use a global variable āLifeTimerā (global so you can modify it from any scene).
To make a variable works as a timer, always increase it with the value āTimeDelta()ā, itās the time elapsed in seconds since the last frame:
Do + TimeDelta() to global variable "LifeTimer"
Test it:
Global variable "LifeTimer" is > 30
And reset it:
Do = 0 to global variable "LifeTimer"
Now you can modify your ātimerā from any scene.
By the way, instead:
Do = GlobalVariable(Lives) + 1 to the global variable "Lives"
HI, I got the timer to work!^^ But I have one other question: If I want the timer to continue in the different scene, do I have to add all the conditions and actions of the global timer to every level?
Thanks
NB.: I canāt help but notice that when I change the tabs in the browser, the Timer pauses. Is this normal for the preview of the game, or will the exported game have the same behaviour?
EDIT: For the ones reading in the future, hereās how I got it to work:
Event 1: Conditions: Global variable Lives <5
Action: Do +TimeDelta() to global variable LifeTimer
Event2: Conditions:Global variable Lifetimer >=30
Trigger once
Actions: Do +1 To Lives
Do =0 To LifeTimer
Event3: Conditions: Global variable Lives >5
Action: Do =0 to global variable LifeTimer
Yes, you could⦠but External Events were made for things like this: Put the code related to the global timer in an external event, then link to it in every scene you want it to work, there is a special event āLinkā to do it (under the green ā+ā in the events editor ribbon)
Haha, thatās true. I donāt know if it should work this way really
A database? I really have not worked with HTTP requests, or anything related to the network, but it would be possible (if Iām right, SQL and others have a lot of built-in functions related to time)
Yeah, I think it would be more reliable to save the state of the player to a database, and trigger the life timer from the base. But that would be for further development.
For now, I will mark it as solved, and if I come up with a good way, I will definitely post a tut
I am using your +TimeDelta() trick for my global timer and it works like a charm. Now I just need to figure out how to pause the timer and I am a bit stuck on that. Could you offer any advice?
Hello! please do not bump threads that are multiple years old and marked as solved. This method should still work, but this thread was for GD4 which was basically an entirely different engine.
At this point, Iād recommend making a new thread and writing up your scenario, what youāre trying to accomplish, and include a screenshot of your current events in question.
With the above in mind, Iām de-bumping this thread and closing it out. Thank you.