Godot 2: Timer slows down after a while

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By fedeb95

In my project I’ve got two timers set at 5 and 5.2 seconds. When the first reaches zero it triggers an animation that lasts 0.2 seconds on a list of nodes, making them disappear, then the other reaches zero and changes the position of the nodes, triggering another animation to make them appear.

The problem is that, after some triggering of those timers, the second one seems to “slow down”, slowly increasing the time between the nodes’ disappearing and appearing. Is there a better way of obtaining what I want, or an explanation to this strange thing?

:bust_in_silhouette: Reply From: mateusak

It’s not strange at all. Look what’s happening:

run 1 > T1 = 05s, T2 = 5.2s
run 2 > T1 = 10s, T2 = 10.4s
run 3 > T1 = 15s, T2 = 15.6s

See? The distance between them is getting larger, and this is because of how you set it up. You want 0.2s after Timer 1 ends, not 5.2s after Timer 1 begins.

What you need to do is set Timer 1 with 5s and Timer 2 with 0.2s. Then, when Timer 1 times out, start Timer 2.

Thank you! Silly me

fedeb95 | 2018-02-25 13:16