0 votes

I start tweens for several sprites. How to determine the moment when all tweens finished? Is there something like Observable? What is the best way to do it?

in Engine by (20 points)

1 Answer

0 votes

You can use Tween's signal tween_completed!

One way of implementing this is to keep track of the number of sprites that exist and the number of signals that have been called. When the number of sprites is equal to the number of signals called, it means that all sprites have completed their tweens; assuming that no sprites are deleted, tweens are not set to repeat, there's only one sprite per tween and one follow_* *, interpolate_*, or targeting_* * handled per tween.

*I couldn't get these two to work, but they should also call the signal when completed, thus if you are using more than one of the those three functions per tween, you'll have to keep track of that when updating your number_of_signals_called variable because the number of signals called will be higher than the number of sprites.

by (58 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.

Categories