0 votes

extends StaticBody2D

func _ready() -> void:
....repeat1()
....repeat2()

func repeat1():
....$Tween.interpolateproperty(self, 'position', Vector2(0,0), Vector2(0,-119), 1 , Tween.TRANSLINEAR, Tween.TRANS_LINEAR)
....$Tween.start()

func repeat2():
....$Tween.interpolateproperty(self, 'position', Vector2(0,-119), Vector2(0,0), 1 , Tween.TRANSLINEAR, Tween.TRANS_LINEAR)
....$Tween.start()

func onTweentweencompleted(object: Object, key: NodePath) -> void:
...._ready()

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

Godot version 3.2.1
in Engine by (69 points)

1 Answer

0 votes

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

by (86 points)
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.