Beispiel #1
0
 /// <summary>
 /// Autogenerates a set of frames based off amount
 /// </summary>
 /// <param name="amount"></param>
 public void AutoGenerate(short amount)
 {
     Frames = new AnimationFrame[amount];
     for (int i = 0; i < amount; i++)
     {
         Frames[i] = new AnimationFrame(Width,Height,(short)(OffsetX + (Width * i)), (short)OffsetY, Time);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Takes an xml frame node and adds it to the animations current frames
 /// </summary>
 /// <param name="node"></param>
 public void AddFrame(XmlNode node)
 {
     AnimationFrame frame = new AnimationFrame(Width, Height, OffsetX, OffsetY, Time);
     foreach (XmlAttribute attr in node.Attributes)
     {
         switch (attr.Name)
         {
             case "width":
                 frame.Width = Int16.Parse(attr.Value);
                 break;
             case "height":
                 frame.Height = Int16.Parse(attr.Value);
                 break;
             case "x":
                 frame.X = (short)(Int16.Parse(attr.Value) + OffsetX);
                 break;
             case "y":
                 frame.Y = (short)(Int16.Parse(attr.Value) + OffsetY);
                 break;
             case "hitboxwidth":
                 frame.HitboxWidth = Int16.Parse(attr.Value);
                 break;
             case "hitboxheight":
                 frame.HitboxHeight = Int16.Parse(attr.Value);
                 break;
             case "time":
                 frame.Time = Int16.Parse(attr.Value);
                 break;
             default:
                 break;
         }
     }
     Frames[frame_upto] = frame;
     frame_upto++;
 }