Hi! I have 2 questions:
1. I have this sequence of animations that I want to happen, The code below animates all at the same time. How can I make it get some sort of delay in between?
2. Aside from that, the animation below should play around 1.5 seconds after my main animation. How do I do so?
I think these two questions are related, soo yeah. Thanks!
kazuo
/*
blah blah blah, other animations here.
*/
for (int expl = 1; expl <= 3; expl++) {
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile: @"explosion.plist"];
CCSpriteBatchNode *explosionSpriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"explosion.png"];
[self addChild:explosionSpriteSheet];
NSMutableArray *explosionAnimFrames = [NSMutableArray array];
for(int i = 1; i <= 7; ++i) {
[explosionAnimFrames addObject:
[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"EX%d.png", i]]];
}
CCAnimation *explosionAnim = [CCAnimation animationWithFrames:explosionAnimFrames delay:0.1f];
_explosion = [CCSprite spriteWithSpriteFrameName:@"EX1.png"];
switch(expl)
{
case 1: _explosion.position = ccp(200, 100);
break;
case 2: _explosion.position = ccp(100, 100);
break;
case 3: _explosion.position = ccp(250, 150);
break;
}
_explosion.scale = _explosion.scale/3;
[_explosion runAction:[CCSequence actions:[CCRepeat actionWithAction:[CCAnimate actionWithAnimation:explosionAnim restoreOriginalFrame:NO] times:1],
[CCCallFuncN actionWithTarget:self selector:@selector(spriteDone:)],nil]];
[[CCSpriteFrameCache sharedSpriteFrameCache] removeUnusedSpriteFrames];
[explosionSpriteSheet addChild:_explosion];
}