Exemplo n.º 1
0
        public void LoadContent()
        {
            const int animationFramesPerSecond = 10;
            var       animations = new Dictionary <AnimationKey, Animation>();

            var animation = new Animation(4, 23, 23, 0, 0, animationFramesPerSecond);

            animations.Add(AnimationKey.Down, animation);

            animation = new Animation(4, 23, 23, 0, 23, animationFramesPerSecond);
            animations.Add(AnimationKey.Left, animation);

            animation = new Animation(4, 23, 23, 0, 46, animationFramesPerSecond);
            animations.Add(AnimationKey.Right, animation);

            animation = new Animation(4, 23, 23, 0, 69, animationFramesPerSecond);
            animations.Add(AnimationKey.Up, animation);

            var spriteTexture = FinalBomber.Instance.Content.Load <Texture2D>("Graphics/Sprites/player1");

            Sprite = new AnimatedSprite(spriteTexture, animations);
            Sprite.ChangeFramesPerSecond(animationFramesPerSecond);

            var playerDeathTexture = FinalBomber.Instance.Content.Load <Texture2D>("Graphics/Sprites/player1Death");

            animation       = new Animation(8, 23, 23, 0, 0, 4);
            _deathAnimation = new AnimatedSprite(playerDeathTexture, animation)
            {
                IsAnimating = false
            };

            // Sounds
            _playerDeathSound = FinalBomber.Instance.Content.Load <SoundEffect>("Audio/Sounds/playerDeath");
        }