Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tween should have ability to wait for signal #11967

Closed
blackears opened this issue Mar 11, 2025 · 2 comments
Closed

Tween should have ability to wait for signal #11967

blackears opened this issue Mar 11, 2025 · 2 comments
Labels

Comments

@blackears
Copy link

Describe the project you are working on

A game that has a complex set of animated graphics that needs to play in sequence and parallel.

Describe the problem or limitation you are having in your project

Synchronizing several animated objects, some of which have either unknown or hard to calculate durations at the time they are started.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

It would be useful to have methods added to Tween that allow you to wait for a signal. Right now there are no methods in Tween that will allow you to wait for a signal. While you can use the await keyword to block, it becomes very messy to combine tween animations with await statements. It would be helpful to have a similar functionality added to the Tween object.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Add a method to Tween like wait_for_signal(target_object, signal_name:String, validate_callback:Callable = null). This would create a new Tweener object that simply blocks until the signal is received.

target_object - Object to wait for a signal from
signal_name - Signal to wait for
validate_callback - An optional validation method. If present, the arguments from the signal are passed as parameters to the callback. If it returns true, the wait condition will be considered finished. Otherwise, it will continue waiting.

If this enhancement will not be used often, can it be worked around with a few lines of script?

You can use the await method to block, but this forces you to split your tween into several different tweens and intersperse them with statements. It would be better to be able to create a single tween that can just wait for signals.

Is there a reason why this should be core and not an add-on in the asset library?

Requires modifying the Tween object.

@Meorge
Copy link

Meorge commented Mar 11, 2025

There's a PR open for this! 😄 godotengine/godot#79712

@AThousandShips
Copy link
Member

Thank you for your proposal, this is already tracked in:

Closing to keep things in one place, please see there for more details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants