现在正在移除第一个炸弹后放置炸弹,现在要求是连续放置炸弹,并且该炸弹只有一个精灵表,如果放置第一个炸弹并立即放置第二个炸弹而不是第一个炸弹,就会出现问题不删除。请帮助我,我是 cocos2d 的新手
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:
@"Bombs.plist"];
_spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"Bombs.png"];
[_tileMap addChild:_spriteSheet z:100 ];NSMutableArray *walkAnimFrames =
[NSMutableArray array];
for(int i = 1; i <=20; ++i)
{
[walkAnimFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache]
spriteFrameByName: [NSString stringWithFormat:@"Bomb_%d.png", i]]];
}
CCAnimation *walkAnim = [CCAnimation animationWithFrames:walkAnimFrames delay:0.1f];
_bomb= [CCSprite spriteWithSpriteFrameName:@"Bomb_1.png" ];
_bomb.position =_player.position;
[_bomb runAction:[CCSequence actions:[CCDelayTime actionWithDuration:0.2f],
[CCAnimate actionWithAnimation:walkAnim],[CCCallFuncN actionWithTarget:
self selector:@selector(spriteDone:)],nil]];
[_spriteSheet addChild:_bomb z:100];
// selector to remove bomb
- (void)spriteDone:(id)sender {
[_spriteSheet removeChild:_bomb cleanup:YES];
_bombRemoved =TRUE; NSLog(@"Bool value: %d",_bombRemoved);
}