Is this the proper way to remove a shape from chipmunk? It seems to work OK.
-(void)cleanupShape:(cpShape*)s
{
NSLog(@"cleanupShape");
cpSpaceRemoveBody(space, s->body);
cpBodyDestroy(s->body);
cpSpaceRemoveShape(space, s);
cpShapeDestroy(s);
}
I also remove the related sprite right after. Does this look right for a sprite with an action?
AtlasSprite *a = [[AppDelegate get].enemyImages objectAtIndex:i];
[[AppDelegate get].enemyImages removeObjectAtIndex:i];
[a stopAllActions];
[a removeAllChildrenWithCleanup:YES];
[self removeChild:a cleanup: YES];
[[TextureMgr sharedTextureMgr] removeUnusedTextures];