public void PlayAnimation(Animation animation)
        {
            if (Animation == animation)
            {
                return;
            }

            this.animation = animation;
            this.frameIndex = 0;
            this.time = 0.0f;
        }
        public void LoadContent()
        {
            player = content.Load<Texture2D>("HeroSprite/hero");

            idleAnimation = new Animation(player, 0.1f, true, 16);

            int positionX = (Level.windowWidth / 2) - (player.Width / 4);
            int positionY = (Level.windowHeight / 2) - (player.Height / 4);
            playerPosition = new Vector2((float)positionX, (float)positionY);

            spritePlayer.PlayAnimation(idleAnimation);
        }
        public void Update(GameTime gameTime)
        {
            if (level.mouseState.LeftButton == ButtonState.Pressed && level.oldMouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Released)
            {
                player = content.Load<Texture2D>("HeroSprite/hero22");

                idleAnimation = new Animation(player, 0.1f, false, 15);

                int positionX = (Level.windowWidth / 2) - (player.Width / 4);
                int positionY = (Level.windowHeight / 2) - (player.Height / 4);
                playerPosition = new Vector2((float)positionX, (float)positionY);

                spritePlayer.PlayAnimation(idleAnimation);
            }
        }