Archive

Author Archive

Rope Simulation with Cocos2d and Box2d

February 5th, 2010 admin No comments

This post presents a good idea on how to simulate a rope using the distance joint in Box2d . I re-implemented it using  Cocos2d.  If you have got problems, please refer to that post for more details or leave a comment. In addition, you can also find another way of simulating a rope using Box2d from here. Read more…

Categories: iPhone Development

Create Composite Object with Box2D

August 14th, 2009 admin 2 comments

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…

Categories: iPhone Development

Distance Joint of Box2D

August 12th, 2009 admin 1 comment

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…

Categories: iPhone Development

How to Use DebugDraw of Box2d with Cocos2d

August 10th, 2009 admin 3 comments

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…

Categories: iPhone Development

How to Implement Grabbing a Sprite with Cocos2d and Box2d

August 5th, 2009 admin 19 comments

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…

Categories: iPhone Development

How to Change the Icon of a Project Template

July 31st, 2009 admin No comments

In last article, I presented how to create a Cocos2d project template. In this article, I will show you how to change the icon of a project template. It is a very easy task.

Read more…

Categories: iPhone Development

How to Create Your Own Cocos2d Project Template

July 29th, 2009 admin 5 comments

In this article, I will present how to create your own Cocos2d project template. The version of Cocos2d is 0.8. The approach used in this article can also be applied when creating the project template using other static libraries.

Read more…

Categories: iPhone Development