Menu
CoddyTech

One After Another

Part of the Game Feel section of Coddy's Godot journey. Lesson 5 of 23.

A tween can hold several steps. Each tween_property call on the same tween waits for the step before it to finish.

var tween = create_tween()
tween.tween_property(self, "position:y", 150.0, 0.4)
tween.tween_property(self, "position:y", 265.0, 0.4)

This is a hop. The node goes up for 0.4 seconds, then down for 0.4 seconds. Each step starts where the last one ended.

Put the whole sequence in one tween. Two create_tween() calls make two tweens that start at the same time and fight over the property.

challenge icon

Challenge

Easy

The robot glides to the pad in 0.5 seconds. Add a second step to the same tween that glides it back home to x = 160, also in 0.5 seconds.

Try it yourself

extends Node2D

func _ready():
	var tween = create_tween()
	tween.tween_property(self, "position:x", 480.0, 0.5)
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Game Feel

Practice on your own: Godot playground