Hi all.
I plan to run actions within schedule, but I have met some trouble.
In init method I've defined an sequence named actionBom and call collisionDetect method by schedule. The sequence first play an animation, and then play bom sound. Unfortunately, the application was down when it run action in spriteBom method. If I comment the runAction code, the application goes well.
Here is the code:
- (id) init {
self = [super init];
if (self != nil) {
Animation *bom = [Animation animationWithName:@"bom" delay:0.03f];
for( int i=1;i<9;i++)
[bom addFrameWithFilename: [NSString stringWithFormat:@"bom%d.png", i]];
actionBom = [Sequence actions:
[Animate actionWithAnimation:bom],
[CallFunc actionWithTarget:self selector:@selector(bomSound)],
nil];
[self schedule:@selector(collisionDetect:)];
}
return self;
}
-(void)collisionDetect:(ccTime)dt {
[self spriteBom:kumo];
}
-(void)spriteBom:(Sprite *)sprite {
[sprite runAction:[actionBom copy]];
}
-(void)bomSound {
[[PASoundMgr sharedSoundManager] play:@"kumo"];
}