mercredi 25 novembre 2015

In Swift how do I get a SKAction to repeat itself after a random period of time

I currently have the below code that happily repeats an action every 2 seconds, but I want it to happen at a completely random period of time, e.g sometime between 1 and 10 seconds, I tried a few different lines of code using arch4random of which none worked. Im hoping its a simple fix, any advice is greatly appreciated.

Thanks runAction(SKAction.repeatActionForever(SKAction.sequence([SKAction.runBlock(callBird), SKAction.waitForDuration(2.0)])))




Aucun commentaire:

Enregistrer un commentaire