Iphone 暂停动作cocos2d self.boxesOnLift=[NSMutableArray]; [自我初始化]; [[CCSpriteFrameCache sharedSpriteFrameCache]addSpriteFramesWithFile:@“Animation.plist”]; NSMutableArray*walkAnimFrames=[NSMutableArray]; 对于(int i=1;i
您需要在要暂停的CCNode上调用Iphone 暂停动作cocos2d self.boxesOnLift=[NSMutableArray]; [自我初始化]; [[CCSpriteFrameCache sharedSpriteFrameCache]addSpriteFramesWithFile:@“Animation.plist”]; NSMutableArray*walkAnimFrames=[NSMutableArray]; 对于(int i=1;i,iphone,ios,cocos2d-iphone,Iphone,Ios,Cocos2d Iphone,您需要在要暂停的CCNode上调用-(void)pauseSchedulerAndActions或-(void)onExit。请注意,尽管此方法在添加/删除节点时可能会产生副作用。您也可以使用-(void)resumeSchedulerAndActions来恢复调度程序及其操作 self.boxesOnLift = [NSMutableArray array]; [self init]; [[CCSpriteFrameCache sharedSpriteFrame
-(void)pauseSchedulerAndActions
或-(void)onExit
。请注意,尽管此方法在添加/删除节点时可能会产生副作用。您也可以使用-(void)resumeSchedulerAndActions来恢复调度程序及其操作
self.boxesOnLift = [NSMutableArray array];
[self init];
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"Animation.plist"];
NSMutableArray *walkAnimFrames = [NSMutableArray array];
for(int i = 1; i <= 9; ++i)
{
[walkAnimFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:
[NSString stringWithFormat:@"lift%d.png", i]]];
}
self.animation = [CCAnimation animationWithFrames:walkAnimFrames delay:0.1f];
self.lift = [CCSprite spriteWithSpriteFrameName:@"lift1.png"];
self.lift.position = ccp(0, 0);
self.walkAction = [CCRepeatForever actionWithAction: [CCAnimate actionWithAnimation:walkAnim restoreOriginalFrame:NO]];
[self.lift runAction:_walkAction];
[self addChild:self. lift];