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
EasySend the robot to the pad and back.
- Under the first step, add a second
tween_propertyon the same tween. - Make it glide
"position:x"back to160.0in0.5seconds.
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
1Tweens
Your First TweenTween Any PropertyFade OutEase OutOne After AnotherAt the Same TimeA Coin That PopsPractice on your own: Godot playground