I have a function that should be called every x seconds. Beginning at x = 5, but every time it calls this function, x needs to be reduced by a certain number. I know how to do this if x is stable:
override func didMoveToView (see: SKView) {NSTimer.scheduledTimerWithTimeInterval (5, target: auto, selector: selector ("function") , UserInfo: zero, repeats: true)} func function () {println ("TEST")}
How do I delay the delay between each function call Can I decrease?
I will change my code in this way:
var timeDuration: NSTimeInterval = 5 Override func didMoveToView (see: SKView) {nSTimer.scheduledTimerWithTimeInterval (timeduration, target: auto, selector: selector ("function"), userInfo: zero, repeats: wrong)} func function () {println ("test ") Timeduration - = 1 if the time duration & gt; 0 {NSTimer.scheduledTimerWithTimeInterval (timeduration, target: self, selector: selector ("function"), userInfo: zero, repeats: wrong)}}
this should work, this test have not done it .
No comments:
Post a Comment