我一直在研究论坛,这里和youtube上寻求答案,但没有取得成功。我在实现这段代码后发现我遇到了错误。谢谢。这是Xcode 8,swift;这是特定的代码和控制台错误:
func startNewLevel1() {
let spawn = SKAction.run(spawnBubble)
let waitToSPawn = SKAction.wait(forDuration: 1)
let spawnSequence = SKAction.sequence([spawn, waitToSPawn])
let spawnForever = SKAction.repeatForever(spawnSequence)
self.run(spawnForever)
}
ibc ++ abi.dylib:以NSException类型的未捕获异常终止 (lldb)
修改
func spawnBubble(){
let randomXStart = random(min: gameArea.minX, max: gameArea.maxX)
let randomYEnd = random(min: gameArea.minY, max: gameArea.maxY)
let spawnPoint = CGPoint(x: randomXStart, y: randomYEnd)
bubble.position = spawnPoint
bubble.zPosition = 1
if #available(iOS 10.0, *) {
let scale = SKAction.scale(to: CGSize(width: 600, height: 600), duration: 5.0)
bubble.run(scale)
} else {
// Fallback on earlier versions
}
// bubble.run(scale)
bubble.name = "circle"
bubble.isUserInteractionEnabled = false
self.addChild(bubble)
}