Say you are using C/SDL for a 2D game project. It's often the case that people use a structure to represent a frame in an animation. The struct consists of an image and how much time the frame is supposed to be visible. Is this data sufficient to represent somewhat complex animation? Is it a good idea to separate animation management code and animation data? Can somebody provide a link to animations tutorials that store animations in a file and retrieve them when needed. I read this in a book (AI game programming wisdom) but would like to see a real implementation.
feedback
|
Yes. When you get down to it, everything on your computer is just data.
Absolutely.
I develop a pair of projects for animating sprites in a data-driven way. There's a sprite maker (not recommended), and a sprite library for XNA that I think works quite well. Here's a copy of some of the documentation. The high-level concept is quite portable:
That is to say that menu items, HUDs, buttons, text, loading screens, all of that is not a Also, each
Any of the above can be left as "Default" if they aren't useful for your application. Every frame can be accessed by using a 4-dimensional array like so:
Where the This concept can work well for frame-based animations, but will require some more thought to be functional for skeleton animations. My SpriteLib project consumes XML that looks something like this:
And splits the SpriteDefinition from the SpriteAnimator because you can have multiple sprite animators working off the same sprite definition. This is just one way to think about 2D animations, but hopefully it will give you a place to start. | |||
feedback
|