Hi! I would like to know how can I break one box to, for example, 8 parts.
Do I need to create 8 new bodies or just 8 new fixtures?
How would I do the cutting to get 8 parts?
What is a correct approach for this task? I would like to dynamically break a box.
I found some tutorials for box2d but can't find it for WCK.
Thanks for any hints/clues!
Do u want a breaking effect to be showed?
In my project to show destroying effect, when two bodies collides. i used cocos2d's CCSpriteFrameCache class that loads a series of Images.. to show that effect
-(id)loadFrames:(int)colors
{
CGSize windowSize = [[CCDirector sharedDirector] winSize];
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"feathers.plist"];
NSMutableArray *animFrames = [NSMutableArray array];
for (int i=1; i<=7; i++) {
CCSpriteFrame *frame1 = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"anime %d.png",i]];
[animFrames addObject:frame1];
}
CCAnimation *animation = [CCAnimation animationWithFrames:animFrames delay:0.03f];
CCSprite *sprite =[CCSprite spriteWithSpriteFrameName:@"anime 1.png"];
sprite.position=ccp(windowSize.width-sprite.contentSize.width/2,windowSize.height-sprite.contentSize.height/2);
id animate = [CCAnimate actionWithAnimation:animation restoreOriginalFrame:NO];
id repeat= [CCRepeatForever actionWithAction:animate];
[sprite runAction:repeat];//[CCSequence actions:repeat,nil]];
return sprite;
}
check that this method returns a sprite and i will be showing that where ever i want
I generated feathers.plist using zwoptex
check out my attachment for images
Thanks, but I would like also to break physical (box2d) object.
In other words, I'd like to break one box2d body to some number of parts (example 8 parts).