Menu
CoddyTech

Tween Any Property

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

A tween can change any property that holds a number, a Vector2 or a Color. Write the property's name in quotes, the same name you use in code: "position", "scale", "rotation_degrees", "modulate".

var tween = create_tween()
tween.tween_property(self, "scale", Vector2(2, 2), 0.5)

This makes the node twice as big in half a second.

The end value must be the same kind of value as the property: a number for rotation_degrees, a Vector2 for position. Do not mix it up with "rotation", which counts in radians. 360 radians is about 57 turns.

challenge icon

Challenge

Easy

Make the robot spin where it stands.

  1. Keep the tween, but change the property from "position" to "rotation_degrees".
  2. Make the end value 360.0 and keep the time at 1.0.

Press Play: the robot makes one full turn without moving. Then Check.

Try it yourself

extends Node2D

func _ready():
	var tween = create_tween()
	tween.tween_property(self, "position", Vector2(480, 265), 1.0)

All lessons in Game Feel

Practice on your own: Godot playground