Tile based collision in XNA

前端 未结 4 1049
小蘑菇
小蘑菇 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 00:57

    You could have a look at the Platformer Starter Kit, it shows how to organize tiles in a map and check for collisions.

    0 讨论(0)
  • 2021-01-06 01:05

    There's a tutorial on pixel based collision detection on XNA Creator's club. You'll need to figure out what objects you want to do collision detection on. I guess you want the character to move across the tiled background, so you don't want to check for collision between your character and the background. Instead you should make any obstacle s sprites and do collision detection on those.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-01-06 01:13

    You might have a look at Nick Gravelyn's Tile Engine Tutorials, it goes through the whole process of creating a tile engine. There's a link here to see all the tutorials on YouTube.

    0 讨论(0)
提交回复
热议问题