For various reason I'm using a mix of PhysicsSprites and CCSprites - with PhysicsSprite being the class defined in the Cocos2d template. I'm doing my own collision detection between the non-physics sprites and PhysicsSprite (this is probably a bad idea...).
I had to extend PhysicsSprite to add:
-(b2Body*) getPhysicsBody;
{
return body_;
}
so I could get the body, and then I could remove the PhysicsSprite like this:
PhysicsSprite * block = [self getChildByTag:blockTag];
b2Body *body = block.getPhysicsBody;
world->DestroyBody(body);
[self removeChild:block cleanup:YES];
I'm still got a feeling I'm missing something, but this seems to work...
No comments:
Post a Comment