我有这个代码:
@implementation MyScene {
SKAction *delayAction;
}
Inside a method:
delayAction = [SKAction waitForDuration:3.0];
[self runAction:[SKAction repeatActionForever: [SKAction sequence:
@[delayAction, [SKAction ...]]]]]
withKey:@"myKey"];
然后我想减少加班时间。(更新时调用此方法:)所以我尝试了:
- (void)updateVelocity
{
NSLog(@"duration:%f",delayAction.duration);
delayAction.duration = delayAction.duration - 0.001;
}
我得到:
2014-04-04 11:45:05.781 FlyFish[5409:60b] duration:1.300000
2014-04-04 11:45:05.785 FlyFish[5409:60b] duration:1.299000
2014-04-04 11:45:05.800 FlyFish[5409:60b] duration:1.298000
2014-04-04 11:45:05.816 FlyFish[5409:60b] duration:1.297000
这看起来不错,但我的 [SKAction ...] 仍然在 3 秒后继续重复。