每次点击屏幕时都会播放声音,但游戏中有轻微的打嗝,你可以看到它落后于屏幕。我该如何解决这个问题?
class level1: SKScene, SKPhysicsContactDelegate, GKGameCenterControllerDelegate {
var jumpSound = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("tapsound", ofType: "wav")!)
var jumpAudioPlayer = AVAudioPlayer()
override func didMoveToView(view: SKView) {
jumpAudioPlayer = AVAudioPlayer(contentsOfURL: jumpSound, error: nil)
jumpAudioPlayer.prepareToPlay()
}
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
theHero.physicsBody?.applyImpulse(CGVector(dx: 0, dy: 200))
jumpAudioPlayer.play()
}
}
答案 0 :(得分:0)
降低播放音频的质量/比特率。