Ale*_*nov 3 delay cocos2d-iphone
我想知道,我怎样才能改变CCAnimation的延迟?
_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];
Run Code Online (Sandbox Code Playgroud)
这工作正常,但我应该改变FPS的速度,我做...
Run Code Online (Sandbox Code Playgroud)[self.monstr stopAllActions]; [self.monstr runAction:self.walkAction]; [self.monstrAnim setDelay:1];
但什么都没发生......
停止walkAction,然后更改动画的延迟,然后重新创建动作并再次运行它.如果您将查看抛出CCAnimate的代码,您将看到,CCAnimation对象的帧之间的延迟仅在动作创建期间使用.所以这段代码
[self.monstr stopAllActions];
[self.monstrAnim setDelay:1.f];
self.walkAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:_monstrAnim restoreOriginalFrame:NO]];
[self.monstr runAction:self.walkAction];
Run Code Online (Sandbox Code Playgroud)
会做的.
| 归档时间: |
|
| 查看次数: |
1494 次 |
| 最近记录: |