title: Collision Detection Logic
body: <p>I'm creating a 2D platformer with XNA, and it's tilebased and as such will have square and sloped tiles.  My question is, how should my algorithm work?  Right now, I have it to where it separates horizontal and vertical movement, which seems to work well for the square tiles, but it fails in relation to the slopes.  Where should I be checking for slope intersection?  </p>
  
  <ol>
  <li>Horizontal check, and subsequent repositioning</li>
  <li>Vertical check, and subsequent repositioning </li>
  </ol>
  
  <p>Where in this algorithm would slopes fall into place?  Or is there another perhaps better solution that I have overlooked which would serve me better?</p>
  
  <p>[EDIT]<br>
  Algorithm Pseudocode</p>
  
  <pre><code>private void Collision()
  {
      if (velocity.X != 0)
      {
          //Check for intersections with new position, reposition if there is an intersection
  
          //Moving to the right
          if (velocity.X &gt; 0)
          {}
  
          //Moving to the left
          if (velocity.X &lt; 0)
          {}
      }
      if (velocity.Y != 0)
      {
          //Check for intersections with new position, reposition if there is an intersections
  
         //Moving downwards
          if (velocity.Y &gt; 0)
          {}
  
          //Moving upwards
          if (velocity.Y &lt; 0)
          {}
      }
  }
  </code></pre>