0 votes

Hello! I want to make a tween move up and down ( this tween will be a trap and it's moving up and down only on Y axis). The problem is that my node moves from up- to down and get back to its place (up) and stops. I want it to continuously move up and down. Do you know how to do it? I tried to use a timer but I didn't succed.

export var move_to = Vector2.DOWN *600
export var speed = 6.0
var follow= Vector2.ZERO

onready var tween = $Tween

func ready():

func physicsprocess(delta):
platform.position= platform.position.linear_interpolate(follow,0.075)

func inittween():
tween.interpolateproperty(self,"follow",moveto, Vector2.ZERO, 3, Tween.TRANSLINEAR, Tween.EASEIN_OUT, 2)

asked Jun 2 in Engine by Riri (22 points)

Can you edit your post and use the code sample tag (mark code, press the icon with "{ }"), to make it easier to read?

2 Answers

+1 vote
Best answer

Here they explain it well:


If there is something you don't understand, comment.

answered Jun 3 by estebanmolca (1,203 points)
selected Jun 3 by Riri

Thank you, it was helpfull. I only needed to connect func ontween_completed(object, key) and to re-call _inittween() .

+1 vote

You said it's already going down and back up, right? The problem here is the loop. Try using the "While" function with a variable(or constant)

var loop = true
Func ready():

While loop == true:

I guess this will keep the Tween looping

answered Jun 2 by migraman (25 points)

Hello, thanks for the answer. If I use while in _ready() function my application crashes , but otherwise it seemed like a good idea .

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 How to use this Q&A? before posting your first questions.