CodeX

Everything connected with Tech & Code. Follow to join our 1M+ monthly readers

Follow publication

Using animations to make a simple chest system (Godot 4/C#)

Let’s discover the power of Godot’s embedded animation events!

Mina Pêcheux
CodeX
Published in
10 min readOct 13, 2023

--

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.

Download a version of Godot with .NET support, to be able to program in C#! :)

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:

--

--

CodeX
CodeX

Published in CodeX

Everything connected with Tech & Code. Follow to join our 1M+ monthly readers

Mina Pêcheux
Mina Pêcheux

Written by Mina Pêcheux

I’m a freelance full-stack web & game developer. I’m passionate about topics like CGI, music, data science and more! Find me at: https://minapecheux.com :)

No responses yet

Write a response