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

Send the robot to the pad and back.

  1. Under the first step, add a second tween_property on the same tween.
  2. Make it glide "position:x" back to 160.0 in 0.5 seconds.

Press Play: the robot reaches the pad, then glides home. Then Check.

Try it yourself

extends Node2D

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

All lessons in Game Feel

Practice on your own: Godot playground