AnimationChainList

Introduction

Represents a list of AnimationChains. This object can be loaded from file and saved to file as well. This object is associated with the .achx file. For information on how to use AnimationChainLists in Glue, see this article. AnimationChains can be displayed by IAnimationChainAnimatables such as Sprites and SpriteFrames. For more information on how to work with AnimationChains in code, see the IAnimationChainAnimatables page.

Loading from file

AnimationChains can be loaded from .achx files which are created in the AnimationEditor. The following code creates an AnimationChain and assigns it to a Sprite. Add the following using statements to reduce code:

using FlatRedBall.Graphics.Animation;
using FlatRedBall.Content.AnimationChain;

In Initialize after FlatRedBallServices.InitializeFlatRedBall:

// If loading from file:
AnimationChainList list = 
    FlatRedBallServices.Load<AnimationChainList>("animation.achx", "Global");
// Or if loading through the content pipeline:
AnimationChainList list = 
    FlatRedBallServices.Load<AnimationChainList>(@"Content\animation", "Global"); 

Sprite sprite = SpriteManager.AddSprite(list);

For information on loading through the Content Pipeline, see the FlatRedBall XNA Content Pipeline wiki entry.

Saving AnimationChainLists

To save an AnimationChainList to file, you can use the AnimationChainListSave object. For more information, see this page.

AnimationChainList Methods

Did this article leave any questions unanswered? Post any question in our forums for a rapid response.

Last updated