Skeletal Animation -- The Plan

I've decided that it would be a good idea for me to rethink my skeletal animation system.

The parts that I have are (Mostly) good, but I'm running into issues as far as how to draw the images.

The method I was previously considering, drawing the whole skeleton onto a surface, then drawing that surface as a sprite, has turned out to be frought with problems.

Given that, I've changed tactics: Instead of simply flipping a sprite to turn the character around, I've added functionality to the animation bones to allow them to invert themselves. This may require some tweaking, but it should work better.
Doing it this way, I don't have to worry about how to align the sprite, which could get messy. I can also save memory by not drawing a whole mess of intermediate images, and I don't have to worry about the size of an intermediate image! ^o^

The bones will draw themselves thusly:

  1. Draw child bones that are always below the current one (This is recursive)
  2. Draw the child bones that should be below the current one based on the direct the skeleton is facing
  3. Compute the angle of the bone and the offset for the image recursively (May optimize this if I have time)
  4. If the skeleton is facing left, flip the offset (Which is still local to the skeleton
  5. Add the offset that represents where the skeleton is being drawn
  6. Rotate the image for the bone by the calculated angle
  7. If the skeleton is facing left, flip the image
  8. Get the Rect for the image, and align its center on the offset point
  9. Blit the adjusted image onto the destination surface (Given as an argument, and also passed to child bones)
  10. Draw the child bones that should be above the current one, based on which direction the skeleton is facing
  11. Draw the child bones that are always above the current one
  12. Finished!


It shouldn't be too much of a problem to get it working. ^_^

I've also been working on other parts alongside the animation system, such as the entity system and object factory, because I don't want to fall behind on other things. :P

And now, back to work! OwO