This is a first attempt at defining a new animation system which should improve the current behaviour of beings, especially the player. The general idea is to have an xml document defining everything about an animation. Here follows an example of what I'm talking about.
<?xml version="1.0"?> <animation name="player"> <images> <image id="0" name="misc" file="player-male-misc.png" width="64" height="64"/> <image id="1" name="stab" file="player-male-stab.png" width="64" height="64"/> <image id="2" name="bow" file="player-male-bow.png" width="64" height="64"/> </images> <actions> <action name="stand" image="0" frames="1"/> <action name="walk" image="0" frames="6"> <frame delay="20"> <frame delay="20"> <frame delay="20"> <frame delay="20"> <frame delay="20"> <frame delay="20"> </action> <action name="sit" image="0" frames="1"/> <action name="die" image="0" frames="1"/> <action name="stab" image="1" frames="4"> <frame delay="20"> <frame delay="30"> <frame delay="20"> <frame delay="20"> </action> <action name="bow" image="2" frames="5"> <frame delay="10"> <frame delay="10"> <frame delay="40"> <frame delay="20"> <frame delay="20" </action> </actions> </animation>
So if you want to load the playerset you just load player.xml and it takes care of loading all related images. Reuse of frames should also be considered, so we could specify the exact frames sequence. Just take the bat as an example. The standing animation as well as the walking one require 4 frames. A bat can hardly stay in flight without flapping his wings as it does now. And in the spritesheet the first 2 rows are identical suggesting one of them could be removed.
<?xml version="1.0"?> <animation name="bat"> <images> <image id="0" name="misc" file="monster15.png" width="60" height="60"/> </images> <actions> <action name="stand" image="0" frames="4"/> <frame delay="20" frame="0"> <frame delay="20" frame="1"> <frame delay="20" frame="2"> <frame delay="20" frame="3"> <action name="walk" image="0" frames="4"/> <frame delay="20" frame="0"> <frame delay="20" frame="1"> <frame delay="20" frame="2"> <frame delay="20" frame="3"> </action> <action name="die" image="0" frames="1"/> </actions> </animation>
Comments
Maybe the <frame> tags should define the spriteset id and the number of the sprite inside the spriteset. That way a single animation could consist of frames from different spritesets and any combination inside the spriteset. a walk animation where the middle animation phase is used twice would look that way:
<action name="walk" image="0" frames="4"> <frame number="0" delay="20" spriteset="0" image="4" /> <frame number="1" delay="20" spriteset="0" image="5" /> <frame number="2" delay="20" spriteset="0" image="6" /> <frame number="3" delay="20" spriteset="0" image="5" /> </action>
--Crush 16:37, 12 March 2006 (CET)