Tile based collision in XNA

前端 未结 4 1089
小蘑菇
小蘑菇 2021-01-06 00:45

I have drawn tiles in my XNA game and loaded my character. My character, however, doesn\'t move- the map does, which gives it the illusion of movement. Now I am wondering ho

4条回答
  •  旧巷少年郎
    2021-01-06 01:06

    Rectangles have a intersects method. If your player is centered and you know the coordinates, loop through the other texture2ds and check for an intersection before scrolling the map.

提交回复
热议问题