![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | aidave |
Let’s say I have a shader effect when the player is hit, then fades away over a few seconds using a Tween. But if the player is hit again before that tween ends, we want to restart that tween from the beginning… not add a second tween!
Here is what I’m trying to do (in psuedo-code), but it doesn’t like it, and the tween never seems to finish.
ERROR: Tween (bound to …): started with no Tweeners.
ERROR: Tween invalid. Either finished or created outside scene tree.
var effect_tween: Tween
ready():
effect_tween = create_tween()
effect_tween.bind_node(self)
effect_tween.connect("finished",Callable(self,"effect_completed"))
func play_effect():
if effect_tween.is_running():
effect_tween.stop()
effect_tween.tween_property(...)