03.animating-the-pickup

Creating the pickup’s animations

In this video, we’ll design the pickup’s animations.

New concepts

Animations replace your nodes’ properties

In Godot, handmade animations directly update the properties of your nodes.

If you have a position track that targets a Sprite at all times, the AnimationPlayer directly changes the position property of the Sprite.

The animation is not relative to some default pose, unlike in some dedicated animation programs.

If you create an animation that changes a character’s position, and then move the character in your scene, the character will jump back to the place saved in your animation tracks as soon as the AnimationPlayer starts.

This is why we always take great care to animate the child sprites of a scene, rather than the root node.

That way, the animation becomes relative to the root node. This allows you to move your scene instance around.

The automatically generated RESET animation

Because the AnimationPlayer actually changes the real values, if you play an animation in the editor, and then save a scene, the animation’s value will be saved as default! This is not what you want.

This is where Godot’s RESET animation comes in handy.

Godot generates a zero-length animation named RESET for you. This animation saves the first keyframe you create for each node and property track.

You can use it in the editor and from code to reset your scene to its starting state.

Quickly keying the position, rotation, and scale

When the animation panel is open, a couple of icons appear in the toolbar above the viewport.

You can use these to quickly key the position, rotation, and scale of selected nodes.

The three icons on the left are toggle buttons.

When they are pressed, clicking the key icon inserts a keyframe for each pressed button.

Finally, the record button on the right tells Godot to automatically insert keyframes when moving, rotating, and scaling nodes.