func gameOver() {
UserDefaults.standard.set(score, forKey: "recentScore")
if score > UserDefaults.standard.integer(forKey: "highscore") {
UserDefaults.standard.set(score, forKey: "highscore")
}
let menuScene = MenuScene(size: view!.bounds.size)
view!.presentScene(menuScene)
}
brain.exe
已停止工作 为什么没有声音?我已经在项目中实现了声音,但程序没有播放任何声音,只显示游戏结束,为什么会这样?
soundWIRDSPIELEN += 1
if soundWIRDSPIELEN == 1 {
run(SKAction.playSoundFileNamed("lose", waitForCompletion: true))
}
soundWIRDSPIELEN -= 1
if soundWIRDSPIELEN == 0 {
gameOver()
}