我正在使用SpriteKit进行游戏,当它启动时,我会产生从屏幕顶部产生并掉落的节点:
let wait = SKAction.waitForDuration(0.2, withRange: 0.19)
let spawn = SKAction.runBlock {
self.addTears()
}
let sequence = SKAction.sequence([wait, spawn])
self.runAction(SKAction.repeatActionForever(sequence))
在这些节点产生之前,我想等待1秒的持续时间,但仅限于游戏开始时。我尝试在运行序列之前添加waitForDuration,但它不起作用。
答案 0 :(得分:2)
尝试:
let otherWait = SKAction.waitForDuration(1)
let otherSequence = SKAction.sequence([otherWait, SKAction.repeatActionForever(sequence)])
runAction(otherSequence)