1
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:
@"Actor.plist"];
spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"Actor.pvr.ccz"];
[self addChild:spriteSheet];
NSMutableArray *walkAnimFrames = [NSMutableArray array];
for(int i = 1; i <= 8; ++i) {
[walkAnimFrames addObject:
[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:
[NSString stringWithFormat:@"clip000%d.png", i]]];
}
CCAnimation *walkAnim = [CCAnimation
animationWithFrames:walkAnimFrames delay:0.07f];
playWalkSound = [CCCallFuncN actionWithTarget:self selector:@selector(PlayRunningSound:)];
walkAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:walkAnim restoreOriginalFrame:NO]];
[actor runAction:[CCSpawn actions:walkAction, nil]];
我想暫停特定的框架和特定觸發這個動畫的動畫。然後在特定觸發後再次恢復動畫。
我嘗試使用stopAction,然後再次runAction。但它會在一些迭代後停止工作。我需要再次製作動畫和動作才能再次運行該動畫。
我嘗試使用pauseSchedulerAndAction和resumeSchedulerandAction但隨後遊戲暫停,如果我嘗試再次觸發暫停而不恢復遊戲崩潰。
有什麼會暫停特定幀上的動畫並再次從同一幀中重新播放。