Member-only story
Using animations to make a simple chest system (Godot 4/C#)
Let’s discover the power of Godot’s embedded animation events!

Wanna learn how to create simple animations in Godot 4, and how to embed powerful method calls in them to trigger some C# logic at a specific moment in the timeline?
Well, in this tutorial, we’re going to see how to implement a little chest system where players can open the chest, and then get a reward inside once the lid has lifted up — all this using animations and animation events!

As usual, since we’ll be coding our logic in C#, make sure that you have a version of Godot with .NET enabled.

And of course, don’t forget that you can get the demo scene and all the assets from this demo on my Github 🚀 with all my other Godot tutorials.
The tutorial is also available as a video — text version is below:
But now, with all that said, let’s dive in and discover the basics of creating animations with events in Godot and C#!
Creating a simple animation
Alright, first of all, let’s see how to make a basic animation in Godot. Our goal will be to have the lid of the chest rotate up, to open the chest and give a reward to the player.

For now, you see that I’ve prepared a simple scene with my chest model inside.
So, now, to create the animation, the first step is to add a new node to our hierarchy of type AnimationPlayer: