title: Having problems drawing animations in monogame
body: <p>I am trying to create a spaceship with multiple animations (idle, attack, damaged, etc)
  But when I'm trying to change the animations I see the first frame of the current animation for a split second on the "old" position (where the animation was changed the last time)</p>
  
  <p>Picture for explanation: <a href="http://i.imgur.com/L3O8rsc.png" rel="nofollow">http://i.imgur.com/L3O8rsc.png</a></p>
  
  <p><em>The red rectangle is supposed to be a health bar.</em></p>
  
  <p>The class that runs my animations:</p>
  
  <pre><code>using System;
  using Microsoft.Xna.Framework;
  using Microsoft.Xna.Framework.Content;
  using Microsoft.Xna.Framework.Graphics;
  
  namespace Test
  {
      class Animation
      {
          Texture2D spriteStrip;
          float scale;
          int elapsedTime;
          int frameTime;
          int frameCount;
          int currentFrame;
          Color color;
          // The area of the image strip we want to display
          Rectangle sourceRect = new Rectangle();    
          // The area where we want to display the image strip in the game
          Rectangle destinationRect = new Rectangle();
          public int FrameWidth;
          public int FrameHeight;
          public bool Active;
          public bool Looping;
          public Vector2 Position;    
          public void Initialize(Texture2D texture, Vector2 position, int frameWidth, int frameHeight, int frameCount, int frametime, Color color, float scale, bool looping)
          {
              this.color = color;
              this.FrameWidth = frameWidth;
              this.FrameHeight = frameHeight;
              this.frameCount = frameCount;
              this.frameTime = frametime;
              this.scale = scale;
              Looping = looping;
              Position = position;
              spriteStrip = texture;
              elapsedTime = 0;
              currentFrame = 0;
  
              Active = true;
          }
          public void Update(GameTime gameTime)
          {
              if (Active == false) return;
  
              elapsedTime += (int)gameTime.ElapsedGameTime.TotalMilliseconds;
              if (elapsedTime &gt; frameTime)
              {
                  currentFrame++;
                  if (currentFrame == frameCount)
                  {
                      currentFrame = 0;
                      if (Looping == false)
                          Active = false;
                  }
                  elapsedTime = 0;
              }
              sourceRect = new Rectangle(currentFrame * FrameWidth, 0, FrameWidth, FrameHeight);
              destinationRect = new Rectangle((int)Position.X - (int)(FrameWidth * scale) / 2, (int)Position.Y - (int)(FrameHeight * scale) / 2, (int)(FrameWidth * scale), (int)(FrameHeight * scale));
          }
          public void Draw(SpriteBatch spriteBatch)
          {
              if (Active)
              {
                  spriteBatch.Draw(spriteStrip, destinationRect, sourceRect, color);
              }
          }
      }
  }
  </code></pre>
  
  <p>The reason that I wrote the whole code is because I don't know where the problem is.
  In my Game1.cs class I have:</p>
  
  <hr>
  
  <p>Global Variables:</p>
  
  <pre><code>Texture2D playerTexture;
  Texture2D playerShootingTexure;
  Animation playerAnimation = new Animation();
  Animation ShootingAnimation = new Animation();
  </code></pre>
  
  <p>...</p>
  
  <pre><code>protected override void LoadContent()
  {
          spriteBatch = new SpriteBatch(GraphicsDevice);
          playerTexture = Content.Load&lt;Texture2D&gt;("Graphics/Player/PlayerShip");
          playerShootingTexure = Content.Load&lt;Texture2D&gt;("Graphics/Player/Player_Shooting");
          playerAnimation.Initialize(playerTexture, Vector2.Zero, playerTexture.Width / 5, playerTexture.Height, 5, 50, Color.Wheat, 1f, true);
          ShootingAnimation.Initialize(playerShootingTexure, Vector2.Zero, playerShootingTexure.Width / 5, playerShootingTexure.Height, 5, 50, Color.WhiteSmoke, 0.75f, true);
  }
  </code></pre>
  
  <p>Where I change the animations:</p>
  
  <pre><code>protected override void Draw(GameTime gameTime)
      {
          GraphicsDevice.Clear(Color.CornflowerBlue);
          // Start drawing
          spriteBatch.Begin();
          if (Player_Attacking == false)
          {
              player.PlayerAnimation = playerAnimation;
          }
          else
          {
              player.PlayerAnimation = ShootingAnimation;
          }
          player.Draw(spriteBatch);
          spriteBatch.End();
  
          base.Draw(gameTime);
      }
  </code></pre>
  
  <p>Note: Player_Attacking is a boolean variable. When 'Space' is pressed, the value of the variable changes to TRUE, when 'Space' is released, value is FALSE</p>
  
  <p>Please help!
  Thanks in advance!
  And sorry for huge wall of text</p>