Hey guys,
I'm a ObjC newbie so sorry if I sound silly here!
I'm working with the Box2D example code. Basically I want to make a box2d world with dynamic and static objects. When you touch/click on a static object it disappears.
I can delete the object using world->DestroyBody(shapeBody), but the Cocos2D sprite is still there.
b2Body* shapeBody = shapes[i]->GetBody();
if (shapeBody->IsStatic() == false && shapeBody->GetMass() > 0.0f) {
// other code goes here
} else {
world->DestroyBody(shapeBody);
}
My question is, how do I determine which sprite I should delete? I could then use a command like [self removeChild:THESHAPESPRITETODELETE cleanup:1];
The Box2D example code uses standard sprite instead of atlas sprite.
I've been searching the net and found Johnny's example of using Box2D here: http://johnehartzog.com/2009/07/using-box2d-physics-engine-with-cocos2d-iphone/ , and he seems to flag an array of some sort.
I really need to learn more ObjC. :P