From The Mana World
Revision as of 15:07, 12 March 2006 by ElvenProgrammer (talk | contribs) (A first attempt at a new animation system)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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>