Good Morning everyone! I’d like to understand the concept of time in GD. For example, lets say I want a scene to play after 5 seconds, what would the events look like? Basically I’d like to do something after x amount of seconds. I tried but it’s not working. I don’t know if the default time is in minutes, hours etc. Also, I’d like to create a dialogue. Like a speech bubble with text coming from a character. How would I go about doing this? Make text in GD? Have txt in .png image? Can you point me to an example?
There are three main ways to measure time in GDevelop:
- Timed events. These are events that are only triggered x seconds after the start of the scene
- Timers. These are stopwatches that can be started, paused and reset as required.
- TimeDelta(). This is a tricky to understand (but very useful) way of measuring the passing of seconds, that avoids problems that timers have with multiple instances of the same object
Timed events can be found in the Add… button on the top bar.
Timers are created as soon as you mention them in an event. e.g.
At the beginning of the scene | Reset the timer "Talktimer"
You can then test how much time has passed in an in-game event:
The timer "Talktimer" is greater than 5 seconds | Change for scene "Scene2"
You can reset the timer (or pause it) in other events, so if you wanted the five seconds to start only after the player picked up a coin, clicked on an icon, pressed a key etc. then rather than resetting the timer in the’ beginning of the scene’ event it would be in a normal event e.g. if you want pressing the N key to start a five second countdown to the scene change:
n key is pressed | Reset the timer "Talktimer"
And then the event that acts on the timer
The timer "Talktimer" is greater than 5 seconds | Change for scene "Scene2"
There’s a useful project here that might help: How to develop with time trial? - #12 by digitalhead
Thanks a lot Man