Topic was automatically imported from the old Question2Answer platform.
Asked By
Zuckey
I have 5 spritesheets that have to be loaded when I call a function but the game freezes for like 0.50 sec beacuse loading all at once, how do I achieve loading these spritesheets frame by frame or over a given time?
Create a loop and write something like yield(get_tree().create_timer(0.5), "timeout") at the end. This way, the script will pause for 0.5 seconds (or any time you want) and will proceed when the time is over. You could probably also use yield(get_tree(), "idle_frame") or yield(get_tree(), "physics_frame"). This will pause your script till the next “_process” or “_physics_process” step will accur.
This seems like a very good solution for this but is this compatible with how load function works?