+1 vote

Hello guys, im trying to tween something like this: https://ibb.co/7WsVJVB
Two consecutive animations parallel to another animation.

I tried to achieve this result in that way, but the last animation does not play, the object immediately returns to its original size, as it should, but without animation. Can anyone suggest how to fix this? Can anyone suggest how to fix this?

var tween = get_tree().create_tween()

tween.tween_property($Sprite, "global_position", Vector2(1,1), 1)
tween.tween_property($Sprite, "scale", Vector2(1.5,1.5), 0.5)
tween.tween_property($Sprite, "scale", Vector2(1,1), 0.5).set_delay(0.5)


Thanks in advance for your help

Godot version 4.0 beta 7
in Engine by (18 points)
edited by

I haven't made a complete switch to Godot 4 yet, so I have limited experience with the new Tween object. However, seeing no other input here, I'll take a stab...

With some playing, I was also unable to accomplish your goal with a single tween. On the surface, the combination of set_parallel() and the set_delay() you have on the 2nd scale tween seems like a plausible way to get the result you want. However, as you know, it doesn't work. I'm not sure if that's intended or possibly a bug in the new Tween object.

You're probably aware, but you can get that to work with two tweens. Probably not an ideal solution, but something like this:

var tween1 = get_tree().create_tween()
var tween2 = get_tree().create_tween()

tween1.tween_property($Sprite, "global_position", Vector2(1,1), 1)
tween2.tween_property($Sprite, "scale", Vector2(1.5,1.5), 0.5)
tween2.tween_property($Sprite, "scale", Vector2(1,1), 0.5).set_delay(0.5)

Also, no need to call tween.play() as it'll do that by default.

Thank you very much!

Please log in or register to answer this question.

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.