我已经构建了一个功能齐全的飞鸟游戏但是当我尝试添加声音时,我甚至无法运行该项目,因为在我玩游戏之前会弹出错误。错误是:
thread 1 exc_bad_instruction (code=exc_i386_invop subcode=0x0)
导入SpriteKit 导入AVFoundation GameScene:SKScene {
var bird = SKSpriteNode()
var pipeUpTexture = SKTexture()
var pipeDownTexture = SKTexture()
var PipesMoveAndRemove = SKAction()
var sound = try? AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("wingsSound", ofType: "waw")!))
let pipeGap = 150.0
覆盖func didMoveToView(view:SKView){ / *在这里设置您的场景* /
sound!.play()