title: Per Pixel collision when animate sprites
body: <p>This is what I have for detecting collision.</p>
  
  <pre><code> public static bool IntersectPixels(Rectangle rectangleA, Color[] dataA, Rectangle rectangleB, Color[] dataB)
      {
          int top = Math.Max(rectangleA.Top, rectangleB.Top);
          int bottom = Math.Min(rectangleA.Bottom, rectangleB.Bottom);
          int left = Math.Max(rectangleA.Left, rectangleB.Left);
          int right = Math.Min(rectangleA.Right, rectangleB.Right);
          for (int y = top; y &lt; bottom; y++)
          {
              for (int x = left; x &lt; right; x++)
              {
                  Color colorA = dataA[(x - rectangleA.Left) + (y - rectangleA.Top) * rectangleA.Width];
                  Color colorB = dataB[(x - rectangleB.Left) + (y - rectangleB.Top) * rectangleB.Width];
                  if (colorA.A != 0 &amp;&amp; colorB.A != 0)
                  {
                      return true;
                  }
              }
          }
          return false;
      }:
  </code></pre>
  
  <p>It work fine until I want to animate stuff. So I have a texture sprite that have about 12 frame. what I need to do is get the color data array of each frame. This is how I get the color data array:</p>
  
  <pre><code> Color[] playerColorArray = new Color[playerColorArray.X * playerColorArray.Y];
   PlayerTexture.GetData(playerColorArray);
   CData = playerColorArray;
  </code></pre>
  
  <p>Now my guess is that i have to update the textureData everytime the frame changes
  Is there a way to get the the color data from each frame only?</p>