我目前有下面的代码,它每 2 秒重复一次操作,但我希望它在完全随机的时间段内发生,例如 1 到 10 秒之间的某个时间,我使用 arch4random 尝试了几行不同的代码,其中没有工作了。我希望这是一个简单的修复,非常感谢任何建议。
谢谢 runAction(SKAction.repeatActionForever(SKAction.sequence([SKAction.runBlock(callBird), SKAction.waitForDuration(2.0)])))
runAction(SKAction.repeatActionForever(SKAction.sequence([SKAction.runBlock(callBird), SKAction.waitForDuration(2.0)])))
random repeat sprite-kit skaction swift
random ×1
repeat ×1
skaction ×1
sprite-kit ×1
swift ×1