Cocos2d + Box2d or Chipmunk [closed]

2019-03-08 04:11发布

问题:

OK, im trying to make an iphone version of a game i made here http://scratch.mit.edu/projects/techy/781198 is box2d or chipmunk better and where are some tutorials for each one

回答1:

If you download the Cocos2d SDK, in the included project is a sample of Box2d and Chipmunk. Just open the Xcode project called "cocos2d-iphone" and look Box2dtest and Chipmunkdemo. Box2d is more powerful, but I think a little harder to use than Chipmunk.

Here's the site for Cocos2d: http://www.cocos2d-iphone.org/

Download here: http://www.cocos2d-iphone.org/download



回答2:

I prefer Box2d - I think it is easier to understand than Chipmunk. Here's a link to another question that lists many usefull resources:

Cocos2d Resources

Plus here are a few links to cocos2d / box2d tutorials:

http://www.raywenderlich.com/457/intro-to-box2d-with-cocos2d-tutorial-bouncing-balls

http://www.raywenderlich.com/606/how-to-use-box2d-for-just-collision-detection-with-cocos2d-iphone

http://www.raywenderlich.com/475/how-to-create-a-simple-breakout-game-with-box2d-and-cocos2d-tutorial-part-12

http://www.raywenderlich.com/505/how-to-create-a-simple-breakout-game-with-box2d-and-cocos2d-tutorial-part-22

And a great book Ray is making that I think will be an awesome resource:

http://www.raywenderlich.com/2274/cocos2d-book-and-360idev

http://my.safaribooksonline.com/9780132180863

Hope these help - Happy coding!



回答3:

Chipmunk is straight C, while Box2D is C++. There is also a new set of Objective-C bindings for Chipmunk, but they are not free to use commercially.

As I understand it, Chipmunk does not support Continuous Collision Detection, but Box2D does. This is important to prevent "tunneling" (objects passing slightly through eachother when moving at high speeds)

At the end of the day, from what I hear, they're both great. If you prefer C++ to C or need continuous collision detection, you should probably choose Box2D.

If you'd rather use a pure C library, go with Chipmunk.

I personally use Box2D and my experience has been fantastic so far.

Also, I think Box2D has a different (possibly larger) set of joint types, so that could be something to consider...