问题描述
我在XNA游戏绘制的瓷砖并装我的性格。我的性格,但是,不MOVE-地图呢,这使得它的运动的错觉。现在我想知道如何来实际测试对他们的碰撞。我的意思是,在不碰撞的代码去,如何让所有的瓷砖代表一件大事?
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 how to actually test against them for collision. I mean, where does the collision code go and how do I make all tiles represent 'one big thing'?
推荐答案
有一个教程中对XNA创造者俱乐部。你需要弄清楚你想要做的碰撞检测哪些对象。我猜你想要的字符在整个平铺背景移动,这样你就不会要检查你的性格和背景之间的碰撞。相反,你应该做的任何障碍小号精灵,做这些碰撞检测。
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.
这篇关于在XNA瓷砖基于碰撞的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!