私のゲームでは、 を使用して 2 つのアニメーションを実行してCCSpawn
いますが、一度に 1 つのアニメーションしか表示されません。ここで何が問題なのですか?これが私のコードです。
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"walkcycle.plist"] ;
CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"walkcycle.png"];
[heroWorldLayer addChild:spriteSheet];
NSMutableArray *runFrames = [NSMutableArray array];
for(int i = 1; i <= 11; ++i) {
CCSpriteFrame *frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"Run_Anim00%02d.png", i]];
[runFrames addObject:frame];
}
id runAnim = [CCAnimation animationWithFrames:runFrames delay:1.0/22.0];
id runAnimate = [CCAnimate actionWithAnimation:runAnim restoreOriginalFrame:NO];
// _runAction = [CCRepeatForever actionWithAction:runAnimate];
// [heroBodySprite runAction:_runAction];
NSMutableArray *poofFrames = [NSMutableArray array];
for(int i = 1; i <= 10; ++i) {
CCSpriteFrame *frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"Poof00%02d.png", i]];
[poofFrames addObject:frame];
}
id poofAnim = [CCAnimation animationWithFrames:poofFrames delay:1.0/20.0];
id poofAnimate = [CCAnimate actionWithAnimation:poofAnim restoreOriginalFrame:NO];
// id poofAction = [CCRepeatForever actionWithAction:poofAnimate];
// [heroBodySprite runAction:poofAction];
[heroBodySprite runAction:[CCRepeatForever actionWithAction:[CCSpawn actions:runAnimate, poofAnimate, nil]]];