This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

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?

in Engine by (38 points)

1 Answer

+1 vote
Best answer

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.

by (122 points)
selected by

This seems like a very good solution for this but is this compatible with how load function works?

I found exactly the thing you were searching for (ResourceInteractiveLoader):

I think I have seen this before but I was very inexperienced then, this is really helpful right now thank you!

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 Frequently asked questions and 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 [email protected] with your username.