Hello,
Sorry everyone, but I am a complete novice. Can anyone tell me how to make a timer that ends the game once it runs out? I've been on here for hours, and can't seem to find any documentation on this.
Thanks in advance
Dave
Create an event at start of layout create a variable and give it an initial value like 10, then use an every event to subtract 1 from the variable.
Create a new event that says if variable is equal to or lower than 0 end game.
An even easier way is System - compare time - equal to 60 seconds (or whatever your limit), then add an action to end the game (go to another layout or something similar).
Hi Thanks for the replies,
I do not see an action that says end the game
All squared away thanks!!
Is there a way to start a timer mid game, and have it do an action when the time is met?
Or - for an object after it spawns, have it destroy itself after x ticks?
Develop games in your browser. Powerful, performant & highly capable.
Never mind. Got it. :-)
Gave the object a number instance variable.
Each tick, I subtract one.
Event - if it's less than or equal to 0, I destroy it.
Thanks.
So - for a mid game timer - create a timer object with an instance variable of X. On System tick - subtract one. Event - when 0, launch your actions.
On System tick - subtract one.
If you do that, your timer changes speed depending on the framerate, which is probably unfair. If you subtract dt instead of one then the variable will count down one every second regardless of the framerate. Have a read of the Delta-time and framerate independence tutorial.
Thanks for the info!
May Timeline plugin can help you. I will release "timer behavior" in the future, it's more suitable in your case.