I am trying to create an app like开发者_开发百科 a CutTheRope. In My game,if i cut the rope,then i want to add sprites to the individual broken bodies.how to accomplish it.
Thanks....
It totally depends how you are breaking your b2Body. I will answer the question according to the most feasible way to break body which is by creating multiple Fixtures on a body. When your body breaks, you destroy a fixture from your main body and recreate that fixture into a new b2Body. In box2d, the "Body", "Fixture" and "Joint" classes allows you to store "userData". So you store the sprite for broken bodies in their respective fixtures and when the body is broken then you can get the sprites for broken bodies from their respective fixtures.
I hope you understand.
精彩评论