Godot Version
Godot version: 4.6
Question
I’m making a health bar for my game, I’m using an @tool script to tween the sizes on control nodes. These work fine if I have the tweens run at the same time but if I want a tween to run after an await the tween doesn’t work. I know that the await finished because if i put a print after that still works
Also doesn’t work when game runs
I’ve put “# doesn’t work” after the tweens that don’t work. - always the second tween is broken after an await
Does anyone have any ideas on why this breaks them?
var barTween = create_tween().set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_CUBIC)
var barBackTween = create_tween().set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_CIRC)
if isLess:#ignore isLess
barTween.tween_property($Health, "size:x", barsize, .1)
await barTween.finished # breaks waiting for tween
print("Finished") # works
barBackTween.tween_property($HealthTween, "size:x", barsize + 50, 1) # doesn't work
elif not isLess: #ignore isLess
#heal
barBackTween.tween_property($HealthTween, "size:x", barsize + 50, 1)
await get_tree().create_timer(.8).timeout # breaks with timer
barTween.tween_property($Health, "size:x", barsize, 0.25)# doesn't work