How to create a play floor?
I am trying to create a game on Lunar Lander on an iPhone. I have Cocos2D and I am going to use Box2D. I'm wondering what is the best way to build a play floor. I need to create both the visual aspect of the floor and the data for the physics engine.
Oh, did I mention that I'm terrible at editing graphics?
source to share
I haven't used Box2D before (but I have used other 2D physics engines), so I can give you a general answer, but not Box2D's specific answer. You can easily use just one static (stationary) box if you want a flat plane as a floor. If you need a more complex lunar surface (many craters, a sea of ββtranquility, etc.), you can build it by creating many different physics objects - boxes will almost always do the trick. You just want to make sure all your fields are static. If you do this, they won't move at all (which you don't want, of course) and they can intersect without problems or problems (simulate one surface).
Generating an image according to your collision data is also easy. Effectively what you need to do is just draw one image that more or less matches the locations of the boxes. Leave any spots that don't have transparent boxes in your image. Then draw it at the bottom of the screen. No problems.
source to share