对于某人来说,这可能是一个非常快速和简单的答案,但我很难把它弄清楚为一个菜鸟。我正在尝试运行我的 CCAnimation,然后运行第二个操作,在完成后从屏幕上删除动画。在我达到这一点之前,我收到“不兼容的指针类型将'CCAction *'发送到'CCFiniteTimeAction *'类型的参数”错误。我怀疑我需要使用除 CCRepeat 之外的东西来运行我的动画,但我不确定用什么来替换它。谢谢!!
NSMutableArray *crabAnimFrames = [NSMutableArray array];
for (int i=1; i<=10; i++) {
[crabAnimFrames addObject:
[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:
[NSString stringWithFormat:@"bashCrab%d.png",i]]];
}
CCAnimation *crabAnim = [CCAnimation animationWithSpriteFrames:crabAnimFrames delay:0.1f];
CGSize winSize = [CCDirector sharedDirector].winSize;
float randomOffset = CCRANDOM_X_Y(-winSize.height * 0.25, winSize.height * 0.25);
render.node = [CCSprite spriteWithSpriteFrameName:@"bashCrab1.png"];
render.node.position = ccp(winSize.width * 0.25, winSize.height * 0.5 + randomOffset);
render.crabWalk = [CCRepeat actionWithAction:[CCAnimate actionWithAnimation:crabAnim] times:1];
[_batchNode addChild:render.node];
[render.node runAction:[CCSequence actions:render.crabWalk, nil]];