Beispiel #1
0
        public void LoadContent(string spriteSet)
        {
            spriteSet = "Textures/" + spriteSet + "/";

            runLeftAnim = new Animation(game.Content.Load<Texture2D>(spriteSet + "RunLeft"), 0.08f, true);
            idleAnim = new Animation(game.Content.Load<Texture2D>(spriteSet + "Idle"), 0.5f, true);
            sprite.PlayAnimation(idleAnim);
        }
Beispiel #2
0
        /// <summary>
        /// Begins or continues playback of an animation.
        /// </summary>
        public void PlayAnimation(Animation animation)
        {
            // If this animation is already running, do not restart it.
            if (Animation == animation)
                return;

            // Start the new animation.
            this.animation = animation;
            this.frameIndex = 0;
            this.time = 0.0f;
        }