/// <summary> /// Play an animation. /// </summary> /// <param name="animationName"></param> public void playAnimation(string animationName) { prevAnimation = curAnimation; curAnimation = animations[animationName]; //Reset previous animation's Active state if its different than the current animation if (prevAnimation != curAnimation) { prevAnimation.Active = true; } }
/// <summary> /// Adding animated sprite. /// </summary> /// <param name="animationName"></param> /// <param name="spritePath"></param> /// <param name="frameWidth"></param> /// <param name="frameHeight"></param> /// <param name="frameCount"></param> /// <param name="frameSpeed"></param> /// <param name="scale"></param> /// <param name="looping"></param> public void addAnimation(string animationName, string spritePath, int frameWidth, int frameHeight, int frameCount, int frameSpeed, float scale, bool looping) { animations.Add(animationName, new DDAnimation(spritePath, frameWidth, frameHeight, frameCount, frameSpeed, scale, looping)); curAnimation = animations[animationName]; }