let randomize = SKAction.runBlock({ [unowned self] in
self.footstepFile = "Content/footstep\(RandomInt(1, max: 4))"
print(self.footstepFile)
})
sprite.runAction(SKAction.repeatActionForever(SKAction.sequence([randomize, SKAction.playSoundFileNamed(footstepFile, waitForCompletion: true)])), withKey: "footsteps")
When this action runs, the footstepFile shows its randomizing when I print it, but in reality it's just playing the same sound file over and over. Why is this?
I play this action whenever the sprite is moving, and pause it whenever he stops. When it pauses and unpauses the footstepFile changes but if I'm continuously running, it just plays the same one over and over. Shouldn't the runblock be randomizing it continuously?