How to handle animation transitions between two different actions in a sprite based game?
Lets say I have three states:
Idle
Walking_Right
Running_Right
For sake of simplicity lets think only in one direction (right).
To handle the animation I operate over the entity velocity: 0 render idle animation, (0,3] walking animation, and (3, MAX_SPEED], running animation.
The walking/running animation speed is based on entity velocity, since it feels like accelerating.
It works nicely, but the transition isn’t “smooth”, hence I’m thinking in create some transition animations as:
Idle->walking
Idle->running
walking->running
running->walking
walking->idle
running->idle
But we can see that this grows exponentially (combinatorics), since I can have more states (as duck, rolling, jumping) also the 8 directions.
I have heard about " blend tree" , besides it makes sense in a skeleton animation based game. I could not see any way to work with sprite based animations, but, nevertheless, I found some online guides/tutorials explaining about “blend tree” in sprite animation
2d sprite animation with blend tree
Is possible to use a blend tree to solve this problem? It makes any sense?
Besides that, in the end, I will also need to write a FSM or HSM or any kind of push automata to handle these transitions and states.
Is there anywhere a documentation explaining how to handle that inside a game? Which data structures should I need? what is a good approach to this problem? How should I model my game entity?
Best regards.