Just waiting 2 s in a function

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

I’m trying to wait for 2 seconds in a function, and do not want the program to jump to the recent function, like the “yield” does. How can I achive this?

Not sure I understand what you want. Since you’re apparently aware of yield and don’t want something like it does…

Do you not want anything else to happen during this 2 seconds? As in, grind your entire game to a halt for 2 seconds?

jgodfrey | 2022-11-15 19:46

I would like the same functionality as yield, but without jumping to recent function. When for example using

yield(get_tree().create_timer(0.2),“timeout”)

plar64 | 2022-11-15 20:29

So can I clarify your question are you saying you want the function to continue while the countdown is happening rather than pausing the function as yield does?

If thats the case just set up a timer and link it to another function which you want to happen at the end of the time.

Gluon | 2022-11-15 21:50

:bust_in_silhouette: Reply From: SteveSmith

You need “OS.delay_msec(2000)