0 votes

Hello, I am working on my first Godot game and I am facing a small issue. It seems the timer wait time is not working properly for small values. I thought the engine had some kind of a minimum wait time value but I can't find anything online. Maybe it is caused by the way the timer is implemented ?

Here is my code, I am just filling the cells of a grid with a delay to have some kind of an animation, but it can't go faster after a certain wait time:

for row in range(grid_heigth):
    for col in range(grid_width):
        set_cell(col, row, GREY_CELL)
        yield(get_tree().create_timer(0.001), "timeout")
Godot version 3.3.2
in Engine by (12 points)

1 Answer

+1 vote

i believe the timer checks on every frame how much time passed from the start. i dont know what system you have, but on my PC a typical frame is something around 0.01s.
So, if you set 0.001s of wait time, with a single frame after start you already passed the wait time.
So yeah, the lower limit is the frame time.

Beside, even if the timer was able to wait 0.001s, your brain wouldn't be able to tell

by (1,455 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.