Iphone 如何暂停和恢复应用于ccSprite的操作?

Iphone 如何暂停和恢复应用于ccSprite的操作?,iphone,cocos2d-iphone,Iphone,Cocos2d Iphone,我已经创造了一个动画像 [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile: @"Actor.plist"]; spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"Actor.pvr.ccz"]; [self addChild:spriteSheet]; NSMutableArray *walkAnimFra

我已经创造了一个动画像

        [[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]];
[[CCSpriteFrameCache sharedSpriteFrameCache]添加SpriteFrameSwithFile:
@“Actor.plist”];
spriteSheet=[CCSpriteBatchNode batchNodeWithFile:@“Actor.pvr.ccz”];
[自添加子项:精灵表];
NSMutableArray*walkAnimFrames=[NSMutableArray];

对于(int i=1;i我通过创建一个具有1帧的动画解决了我的问题

[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:
 @"Actor.plist"];
spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"Actor.pvr.ccz"];
[self addChild:spriteSheet];
NSMutableArray *walkAnimFrames = [NSMutableArray array];
for(int i = 1; i <2; ++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]];
[[CCSpriteFrameCache sharedSpriteFrameCache]添加SpriteFrameSwithFile:
@“Actor.plist”];
spriteSheet=[CCSpriteBatchNode batchNodeWithFile:@“Actor.pvr.ccz”];
[自添加子项:精灵表];
NSMutableArray*walkAnimFrames=[NSMutableArray];
对于(int i=1;i
[[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]];