Godot Version
`Godot 4’
I’m trying tweens out for the first time and the code is below
everytime I click on the object the it keeps moving further and further left,
but I want it to reset back to the original position it was in and replay the animation, so how would one do that? I’m also trying to decipher kill() and loops but im a bit confused
here’s the code I’m using for the tween
func _input(event):
var tween = create_tween()
if event is InputEventMouseButton:
tween.set_speed_scale(8)
tween.tween_property(self, "position", position - Vector2(5, 0), 1)
tween.tween_property(self, "position", position - Vector2(0, 4), 1)
tween.tween_property(self, "position", position - Vector2(-4, 0), 1)
tween.tween_property(self, "position", position - Vector2(0, -3), 1)
tween.tween_property(self, "position", position - Vector2(2, 0), 1)
tween.tween_property(self, "position", position - Vector2(0, 0), 1)