How to create a level with curved lines with cocos2d + Box2d on iphone?

I would like to create a game with such levels: http://img169.imageshack.us/img169/7294/picdq.png

The player moves “flies” through the level and should not collide with walls. How can I create such levels?

I found that piece of software: http://www.sapusmedia.com/levelsvg/

It is not so cheap, so I wonder if there is another way to create such a level, as shown in the picture above ...?

+7
iphone collision cocos2d-iphone curve box2d
source share
2 answers

You can do this quite easily by reading the color value of the pixels in certain places of the level. Take for example that your background level is white and the walls are black. To perform a collision detection, if your character hit the wall, you must do the following: -accept your character’s position Look at the color values ​​of the pixels of your map that overlap with the bounding box or sphere in this position if any of them contains black, you there is a collision :)

Now, if your level is all colors, you would like to create a black and white mask texture that will reflect the wall surface of your real map. Then use a color map for drawing and a bw map for collision detection.

+6
source share

I would spend a couple of weeks getting into Objective-C, Xcode, Interface Builder, and the Apple iOS documentation. There are many good tutorials and sample Xcode projects to download and run on the iPhone / iPad simulator.

If you are just starting out, some of these quick launch libraries may rob you of the in-depth knowledge that you will need to create the subtleties and nuances that you will need when your application begins to go beyond the sandbox. It’s nice to use training tools or speed up development time, but I would advise you not to use them as a crutch until you strengthen the legs of the developer. Crawl To walk. Run!

+1
source share

All Articles