/// <summary>
 /// Starts playing an animation.
 /// </summary>
 /// <param name="animation">
 /// Animation to try and start playing.
 /// </param>
 public void PlayAnimation(Animation animation)
 {
     if (Animation != animation)
     {
         this.animation = animation;
         this.frameIndex = 0;
         this.time = 0.0f;
     } //end if
 }
        /// <summary>
        /// Constructor to instantiate a new player.
        /// </summary>
        /// <param name="level">
        /// Get level to use its ContentManager.
        /// </param>
        /// <param name="position">
        /// Set starting position of the player.
        /// </param>
        public Player(Level level, Vector2 position)
        {
            this.level = level;
            lives = 3;

            idle = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/Idle"), 0.1f, true);
            run = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/Run"), 0.1f, true);
            jump = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/Jump"), 0.1f, false);
            win = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/Win"), 0.1f, false);
            death = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/Die"), 0.1f, false);

            int width = (int)(idle.FrameWidth * 0.4);
            int left = (idle.FrameWidth - width) / 2;
            int height = (int)(idle.FrameWidth * 0.8);
            int top = idle.FrameHeight - height;
            localBounds = new Rectangle(left, top, width, height);

            deathSound = Level.Content.Load<SoundEffect>("Sounds/death");

            Reset(position);
        }