在我的GameOverScene
我有SKSpriteNode
我希望在特定时间内出现。因此,当场景GameOverScene
加载SKSpriteNode
纹理“再次播放”时,需要2秒才能显示。
playButton = SKSpriteNode(texture: playAgainTex)
playButton.position = CGPointMake(self.frame.size.width * 0.45, self.frame.size.height * 0.33)
self.addChild(playButton)
答案 0 :(得分:0)
请试试这个
let playButton = SKSpriteNode(texture: playAgainTex)
playButton.position = CGPointMake(self.frame.size.width * 0.45, self.frame.size.height * 0.33)
let wait = SKAction.waitForDuration(2)
let add = SKAction.runBlock { self.addChild(playButton) }
let sequence = SKAction.sequence([wait, add])
self.runAction(sequence)
希望这有帮助。