Hi I'm trying to generate random time intervals everytime the action is repeated but it only generates the time interval randomly only when the vied did load.
Here is my code :
let moveBucketLeft = SKAction.moveByX(400, y: 0, duration: NSTimeInterval(grabRandomTime()))
let moveBucketRight = SKAction.moveByX(-400, y: 0, duration: NSTimeInterval(grabRandomTime()))
moveBucketLeftAndRight = SKAction.sequence([moveBucketLeft,moveBucketRight])
let repeatMovement = SKAction.repeatActionForever(moveBucketLeftAndRight)
bucket.runAction(repeatMovement)
The method grabRandomTime just generates a random duration between 1 and 5 .
I need all the help I can help. Thank you!
Aucun commentaire:
Enregistrer un commentaire