当我的英雄节点收集硬币时,当我的游戏播放时有一点障碍。为什么会这样?这是我的代码:
class GameScene: SKScene, SKPhysicsContactDelegate,
GKGameCenterControllerDelegate {
var popSound = NSURL(fileURLWithPath:
NSBundle.mainBundle().pathForResource("pop", ofType: "wav")!)
var popAudioPlayer = AVAudioPlayer()
override func didMoveToView(view: SKView) {
popAudioPlayer = AVAudioPlayer(contentsOfURL: popSound, error: nil)
}
if firstBody.categoryBitMask == HeroCategory &&
secondBody.categoryBitMask == CoinCategory {
coinAudioPlayer.play()
coinAudioPlayer.currentTime = NSTimeInterval(1.0)
coinAudioPlayer.prepareToPlay()
}