AnimationPlayer
Part of the Game Feel section of Coddy's Godot journey. Lesson 20 of 23.
An animation is a motion made ahead of time, like an idle bob or a door that opens. It is kept in an AnimationPlayer node.
An animation holds tracks. Each track changes one property. Its keys are values at set times, like y = 300 at 0 seconds and y = 288 at 0.6 seconds. Godot fills in the moments between the keys.
This robot's AnimationPlayer has two animations: "bob", a hover that loops, and "hop", a jump.
$AnimationPlayer.play("bob")The name must match exactly, capitals included. A looping animation plays until you play another one or call stop().
Challenge
EasyMake the robot hover.
- In
_ready(), take$AnimationPlayer. - Call
play("bob")on it.
Press Play: the robot bobs up and down. Then Check.
Try it yourself
extends Node2D
func _ready():
pass
All lessons in Game Feel
Practice on your own: Godot playground