c# - Collision Detection Logic -


i'm creating 2d platformer xna, , it's tilebased , such have square , sloped tiles. question is, how should algorithm work? right now, have separates horizontal , vertical movement, seems work square tiles, fails in relation slopes. should checking slope intersection?

  1. horizontal check, , subsequent repositioning
  2. vertical check, , subsequent repositioning

where in algorithm slopes fall place? or there perhaps better solution have overlooked serve me better?

[edit]
algorithm pseudocode

private void collision() {     if (velocity.x != 0)     {         //check intersections new position, reposition if there intersection          //moving right         if (velocity.x > 0)         {}          //moving left         if (velocity.x < 0)         {}     }     if (velocity.y != 0)     {         //check intersections new position, reposition if there intersections         //moving downwards         if (velocity.y > 0)         {}          //moving upwards         if (velocity.y < 0)         {}     } } 


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -