的速度,我有這樣的代碼:修改正在運行的SKAction
@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秒後重復。
很好的解決方案。無論如何,我解決與不同的aproax。我用actionForKey搜索了該動作:然後將其刪除。之後,我用diffenret waitForDuration再次啓動它。 – Godfather