With Box2D, it’s very easy to create the composite object, which is composed of different standard small objects (e.g, polygon, circle, etc). This feature is useful when the shape of your sprite is complex. In this article, I will present how to achieve it.
Read more…
In this article, I will present how to create a distance joint with Box2D. The example in my last article How to Use DebugDraw of Box2d with Cocos2d is used as the basis. A box is added to the world, and a distance joint between the box and ball will be created.
Read more…
Cocos2d-iPhone just released v0.8.1-Beta. A great news is DebugDraw of Box2D works with Cocos2d now. I tried DebugDraw with Cocos2d v0.8.0 before, but nothing shows up. In this article, I will briefly introduce how to use DebugDraw with Cocos2d v0.8.1-Beta. Note: The following example is based on the article How to Implement Grabbing a Sprite with Cocos2d and Box2d. I used DebugDraw instead of the ball sprite. Another thing should be noticed is something changed in Box2d. For example, b2Body::CreateShape is removed, you should use b2Body::CreateFixture instead. You can see some changes from the source codes of following example.
Read more…
With Box2d, it’s not difficult to implement an app in which we can grab a sprite with touches. The core function we should use is called mouse joint. In this article, I want to show the basic ideas and steps of implementation. Note: this example is based on one of my previous articles – Cocos2d Example – Box2d. The only difference is I moved the codes regarding to the sprite ball from MyScene to BallLayer.
Read more…
Recent Comments