• Advertisement
Sign in to follow this  

2D Animation Format??

This topic is 5005 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am making my own animation format for 2D graphics, i need some help to avoid pitfalls in advance, i have chosen XML for saving it. now here's my approach:
// The XML Prototype
<Animation Sets="2">
    <TileSet Bitmap="Anim.bmp" TileWidth="64" TileHeight="64"/>
    <Set1 Name="Walk" FrameDelay="100" Frames="4" Frame0="0,0" Frame1="0,1" Frame2="0,2" Frame3="0,3" />
    <Set2 Name="Stand" FrameDelay="200" Frames="1" Frame0="0,4" />

// The implementation prototype
// Create two animated 2d objects
cAnimation Toad, Toad2;
// Load tileset and animation info from file
Toad.Load( "Anim.xml" );
// Animation info is loaded already just acquire pointer to it to save 
// memory
Toad2.GetAnimInfo( &Toad );
// Allow easy functions to play them
	Toad.Play( "WalkLeft", mfElapsedTimeSincelastFrame );

Toad2.Play( "Jump", mfElapsedTimeSincelastFrame );
here is how i plan to do these things is it ok to go with this approach?

Share this post

Link to post
Share on other sites
hello there,

we use xml to store our animation description too,
the only thing we do differently, is when an xml document is loaded,
it is cached, and the next time it is loaded it simply returnes the cached version, we dont expose the 'cAnimation' class to the developer in our engine, instead it is handled internaly using the xml file as an alias.


//load up me.xml
//internaly use existingly parsed and cachced xml data

as for playing the animation, we also have a boolean flag we pass, that lets us specify not to restart an animation if it is already playing, helpfull at times=)

Share this post

Link to post
Share on other sites
So do you keep a static list of all loaded animations??
or you do it another way??
Moreover i was thinking about hiding my XMLs in some way, so i stop the kids from making funny alterations to my animations and other game XML files.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement