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?

+2


source to share


2 answers


The method I came across (you can see from my other questions) is to dynamically create the floor at runtime and then draw it to the screen.



0


source


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.

0


source







All Articles