At the Same Time
Part of the Game Feel section of Coddy's Godot journey. Lesson 6 of 23.
Some changes should happen together, like a coin that grows while it fades. parallel() makes the next step run at the same time as the step before it.
var tween = create_tween()
tween.tween_property(self, "scale", Vector2(2, 2), 0.5)
tween.parallel().tween_property(self, "modulate:a", 0.0, 0.5)The node grows and fades in the same half second. A step without parallel() waits for the step before it, as usual.
To run every step of a tween together, call tween.set_parallel() once after create_tween().
Challenge
EasyMake the robot spin while it glides.
- Keep both steps in the same 1 second.
- Put
.parallel()on the second step, the spin, so it starts with the glide.
Press Play: the robot rolls onto the pad in one move. Then Check.
Try it yourself
extends Node2D
func _ready():
var tween = create_tween()
tween.tween_property(self, "position", Vector2(480, 265), 1.0)
tween.tween_property(self, "rotation_degrees", 360.0, 1.0)
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