1
\$\begingroup\$

I am writing a 2d game (in libGDX, but I think that doesn't matter too much). In that game I want to have smooth transitions between animations. For example, let's think of a guy walking around. Now that guy is hit by something (a bullet for example) and dies. So I want to play the death animation for this guy now.

The problem: I cannot simply exchange the walking animation by the death animation, because the guy's current walking animation frame is not necessarily the same as the first frame of the death animation. So for the player that would look as if the animation "jumps" from walking to death.

So my question is: what is the "typical" way to achieve a nice and smooth transition from animation to another, in general?

\$\endgroup\$
5
\$\begingroup\$

There are several different options for handling what you are attempting: These are not all or nothing solutions, you can mix and match them to balance the workload between programming and creating animations.

Option 1

Can be used on a case by case basis. Obscure it. The transition between animation states can simply be hidden behind various effects. Blood spurts, explosions, dust clouds are all common options

Option 2

Applies mostly to frame based animations. Create a lot of transition animations, you generally don't need to consider every frame of every animation transitioning to the beginning of every other animation, just enough to get the smoothness you desire.

Option 3

Applies to animations based on skeletons. Use an animation system that provides interpolating from one animation to another. An example would be Spine, which has a runtime for libGDX.

Option 4

Delay the transition until your first animation reaches a point that it can be transitioned. This can be combined with a change in the game update to speed up or slow down the look of the game as desired.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.