X hits on this document

250 views

0 shares

0 downloads

0 comments

80 / 102

           animationDefinition.Attribute("FrameWidth").Value);

       frameSize.Y = int.Parse(

           animationDefinition.Attribute("FrameHeight").Value);

       // Get the frames sheet dimensions

       Point sheetSize = new Point();

       sheetSize.X = int.Parse(

           animationDefinition.Attribute("SheetColumns").Value);

       sheetSize.Y = int.Parse(

           animationDefinition.Attribute("SheetRows").Value);

       // If definition has a "SplitFrame" - means that other animation

       // should start here - load it

       if (null != animationDefinition.Attribute("SplitFrame"))

           splitFrames.Add(animatonAlias,

int.Parse(animationDefinition.Attribute("SplitFrame").Value));

       // Defing animation speed

       TimeSpan frameInterval = TimeSpan.FromSeconds((float)1 /

int.Parse(animationDefinition.Attribute("Speed").Value));

       Animation animation = new Animation(texture, frameSize, sheetSize);

       // If definition has an offset defined - means that it should be

       // rendered relatively to some element/other animation - load it

       if (null != animationDefinition.Attribute("OffsetX") &&

           null != animationDefinition.Attribute("OffsetY"))

       {

           animation.Offset = new Vector2(int.Parse(

               animationDefinition.Attribute("OffsetX").Value),

int.Parse(animationDefinition.Attribute("OffsetY").Value));

       }

       animations.Add(animatonAlias, animation);

   }

}

// Define initial state of the catapult

currentState = CatapultState.Idle;

...

Page | 80

Document info
Document views250
Page views250
Page last viewedTue Dec 06 19:23:33 UTC 2016
Pages102
Paragraphs3115
Words17333

Comments