Menu
CoddyTech

Your First Tween

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

A tween changes a property smoothly over time. You give it the property, the end value and the number of seconds. Godot changes the property a little every frame until it gets there.

func _ready():
	var tween = create_tween()
	tween.tween_property(self, "position", Vector2(400, 100), 2.0)

create_tween() makes a tween. tween_property() takes four values: the node to change (self is the node the script is on), the property's name in quotes, the end value and the time in seconds.

The tween starts by itself and stops when it is done. You do not need _process.

challenge icon

Challenge

Easy

The robot jumps straight onto the amber pad. Make it glide there instead. Tween its position to Vector2(480, 265) over 1 second.

Try it yourself

extends Node2D

func _ready():
	position = Vector2(480, 265)
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