I am on my first attempt to build a skeletal animation system for 2D side-scrollers, so I don't really have experience of what may appear in later stages. So i ask advice from anyone that been there and done that!

My approach:

I built a Tree structure, the root node is like the center-of-mass of the skeleton, allowing to apply global transformations to the skeleton. Then, i make the hierarchy of the bones, so when moving a leg, the foot also moves. (I also make a Joint, which connects two bones, for utility).

I load animations to it from a simple key frame lerp, so it does smooth movement.

I map the animation hierarchy to the skeleton, or a part of it, to see if the structure is alike, otherwise the animation doesnt start.

I think this is pretty much a standard implementation for such a thing, even if i want to convert it to a Rag Doll on the fly..

Now to my question:

Imagine a game like prototype, there is a skeleton animation of the main character, which can animate all meshes in the game that are rigged the same way.. That way the character can transform into anything without any extra code.

That is pretty much what i want to do for a side-scroller, in theory it sounds easy, but I want to know if that will work well. If the different people will be decently animated when using the same skeleton-animation pair. I can see this working well with a Stickman, but what about actual humans? Will the perspective look right, or i will need to dynamically change the sprites attached to bones?

What do you recommend for such a system?


2 Answers 2


If I understand it right, you have the following situation:

  • 1 Skeleton
  • User-animations for that skeleton (player presses jump, the skeleton jumps)
  • A set of sprites which you attach to the joints of that skeleton

What you need:

  • AI-animations for the NPCs/enemies.
  • A set of sprites characterizing the individual NPC

As long as you don't change the skeleton, you can simply "take-over" any NPC/enemy by dynamically switching from AI-animations to User-animations and setting the chosen character as user-controlled.

NOTE: Since you always have the same skeleton, all characters have the same hight, arm length etc. You might want to create and animate multiple skeletons to provide some variety.

  • \$\begingroup\$ actually, the heights and widths of the bones could be changed dynamically (think for example of a stretching arm! ), the structure is what counts, each bone properties are just flexible to any values. Thanks for the answer, it did help me reflect about it, but I still could use more tips, on how to do the best with such a system :) \$\endgroup\$
    – Grimshaw
    Feb 29, 2012 at 20:03

Depending on art style, you will need to be able to animate the sprites attached to the bones.

Think of different attacks, where the hands might need to open or close. Or drawing "action lines" to make a punch look super fast or powerful. Or changing facial expressions.

If you're going for a more realistic art style, you're also going to find it difficult to make the seems/joints look natural, too. Drawing/rendering an entire sprite can produce much more visually appealing results, at the expense of less flexibility and possibly more work for the artists.

I would suggest looking into some of the Flash character animation packages. They provide the same features you have, plus vector art capabilities which can be handy, plus IK solver support which is necessary for some types of games.

A lot of 2D games actually just use Flash as their animation tool and import "characters" from SWF files.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .