Topic was automatically imported from the old Question2Answer platform.
Asked By
indy2005
So I thought this would work, but it expands one and contracts once, but then the second yield never gets triggered when I though this would be a way to get the node to grow and shrink repeatedly. It’s almost as if, once a tween has fired an on_completed event, it never fires it again, even if you set it to start() again?
var tweenExpand = Tween.new()
var tweenContract = Tween.new()
# Called when the node enters the scene tree for the first time.
func _ready():
add_child(tweenExpand)
add_child(tweenContract)
tweenExpand.interpolate_property(self, "scale", null, Vector2(2.0,2.0),2,Tween.TRANS_LINEAR)
tweenContract.interpolate_property(self, "scale", Vector2(2.0,2.0), Vector2(1.0,1.0),2,Tween.TRANS_LINEAR)
applyTweens()
func applyTweens():
while true:
tweenExpand.start()
yield(tweenExpand,"tween_completed")
tweenContract.start()
yield(tweenContract,"tween_completed")
I just tried your first script and it works just fine for me (Godot 3.2.1). Is anything else happening in your code which could affect / remove tweenContract during execution?
Thomas Karcher | 2020-09-17 06:33
No that I am aware of. I am instancing these nodes, not sure if that makes a difference.
indy2005 | 2020-09-17 08:08
Could you upload your project (or an excerpt of it) somewhere?