Hi. I recently tried to make animations with LibGDX and I was really disappointed by the limitations and I tried to create my own animation system.
It works as intended, but I’m not sure that I’m doing it the right way so I’m seeking you expertise.
Here is how it works:
Firstly, There is the Animation class that has all the basic informations like (position, id, textures, …) and the drawables, i will explain them later.
This class is mainly used to handle the ressources and be used in Drawables’ functions.
And then, there is the Drawable class, this one can be considered as a frame.
Each frame can react differently when ticked, rendered or when it ends, for example, it can wait until his ttl has ended and start other frames or simply end the animation. (This part is very basic for the moment, I’m adding stuff when needed).
And lastly, there is the AnimationController class, this one is used to interact with all the loaded Animations or to load/export a json file that contains all the informations about the animation.
It’s a sort of link between the game and the animations.
Source code:
I won’t include the source code in this thread as it would be too long.
Classes: Github.
Json example: Github.
Let me know what you think of it and if you don’t understand something in the code, I can explain it.