All lessons
Lesson 18

Simple Animation

Squash and stretch the player between an idle and a walk. The animations live in the scene, not the code.

Loading the game engine. This takes a moment the first time.

The animations are NOT in the code. They are saved in the scene file. Open simple_animation.tscn in Godot and click the AnimationPlayer node to see the two of them: "idle" and "walk". Each one squashes and stretches the player's size over time.

The scenes

UI node · 2D node · % unique name · .tscn instanced scene

simple_animation.tscn
  • SimpleAnimation Node2D simple_animation.gd
  • AnimPlayer CharacterBody2D player.tscn
player.tscn
  • AnimPlayer CharacterBody2D player.gd
  • Sprite Sprite2D %
  • CollisionShape2D
  • AnimationPlayer %
extends Node2D