how to loop tween

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By szccornish

extends StaticBody2D

func _ready() → void:

func repeat1():
…$Tween.interpolate_property(self, ‘position’, Vector2(0,0), Vector2(0,-119), 1 , Tween.TRANS_LINEAR, Tween.TRANS_LINEAR)

func repeat2():
…$Tween.interpolate_property(self, ‘position’, Vector2(0,-119), Vector2(0,0), 1 , Tween.TRANS_LINEAR, Tween.TRANS_LINEAR)

func _on_Tween_tween_completed(object: Object, key: NodePath) → void:

How do i get it to loop? because it is not working. thank you

:bust_in_silhouette: Reply From: Snudgley

I am unable to reproduce your issue. Your code runs fine for me. Perhaps check that the Tween’s tween_completed signal is connected properly.

Also don’t forget that Tween’s have a repeat check box which repeats the animations without having to do it through code