Cocos2d iphone 变更延迟通知

Cocos2d iphone 变更延迟通知,cocos2d-iphone,delay,Cocos2d Iphone,Delay,我想知道,我怎样才能改变交通延误 _monstrAnim = [CCAnimation animationWithFrames:monstrAnimFrames delay:0.1f]; self.monstr = [CCSprite spriteWithSpriteFrameName: [NSString stringWithFormat:@"monstr_%d_1.png", currentLevel]]; self.walk

我想知道,我怎样才能改变交通延误

_monstrAnim = [CCAnimation animationWithFrames:monstrAnimFrames delay:0.1f];
                self.monstr = [CCSprite spriteWithSpriteFrameName: [NSString stringWithFormat:@"monstr_%d_1.png", currentLevel]]; 
                self.walkAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:_monstrAnim restoreOriginalFrame:NO]];
                [self.monstr runAction:self.walkAction];
                [monstrSpriteSheet addChild:self.monstr z:1];
这工作很好,但我应该改变速度的FPS和我做


但什么也没发生…

停止您的walkAction,然后更改动画的延迟,然后重新创建action并再次运行它。如果您查看CCAnimate的代码,您将看到,来自CCAnimation对象的帧之间的延迟仅在动作创建期间使用。所以这个代码

[self.monstr stopAllActions];
[self.monstrAnim setDelay:1.f];
self.walkAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:_monstrAnim restoreOriginalFrame:NO]];
[self.monstr runAction:self.walkAction];

你什么时候运行第二位代码?除非您保留cAnimation,否则它可能会在运行后发布。欢迎您。顺便说一下,我不知道你在程序中做什么,但这是一种罕见的情况,我在运行后存储了操作。它将在运行后保留,并在完成后释放。从这段代码来看,类的walkAction属性似乎是不必要的。但这只是IMHO=)
[self.monstr stopAllActions];
[self.monstrAnim setDelay:1.f];
self.walkAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:_monstrAnim restoreOriginalFrame:NO]];
[self.monstr runAction:self.walkAction];