XNA C# 2D Platformer Game

偶尔善良 提交于 2019-12-03 13:19:31

问题


I'm trying to make (figure out how to..) a 2d platformer in XNA.

I know how to create a tile grid and how to perform collision detection. I perform collision detection on the 9 bounding tiles of the player, but I'd like to know if there's a better way to perform collision detection.

I've read Braid doesn't use tiles but pieced images or something, how do you perform collision detection on those? and is that better than using tiles?


回答1:


Assuming you don't mind using a third party tool to do the majority of the work for you, you may be better off using something like Box2D for C#.

http://www.box2d.org/ http://code.google.com/p/box2dx/

This library will give you collision detection and physics capabilities.




回答2:


If you're going for a retro style then it's certainly fine to use tiles! However, if you want something more "modern", then you can go with a more conventional physics engine. Farseer Physics is a great engine, and several people have used it to make platformers. It's based on Box2D and similar engines, but offers a simpler API and several unique features (like texture to geometry) and i myself can testify to it's niceness having played around with it a bit.




回答3:


You probably need a bit more than collision detection for a game like Braid. I would assume that you also need a physics engine. I would recommend that you take a look at Farseer Physics engine, which is 2D engine that works very well with XNA. It supports a number of different techniques for collision detection.




回答4:


Have you checked the examples in the collision serie on the XNA creators club, in particular the pixel-collision sample?



来源:https://stackoverflow.com/questions/2227888/xna-c-sharp-2d-platformer-game

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!