2
我試圖通過觸摸按鈕暫停我的遊戲,但無法使其工作。如何在SpriteKit和SceneKit中暫停遊戲 - SWIFT
我嘗試這樣做:
pause = SKSpriteNode (imageNamed: "pause.png")
pause.size = CGSizeMake(30, 30)
pause.position = CGPointMake(30, 30)
self.addChild(pause)
,我試圖調用這樣的功能:
func touchesBegin (touches: NSSet!, withEvent event: UIEvent!)
{
for touch: AnyObject in touches
{
let location = touch.locationInNode(self)
if self.nodeAtPoint(location) == self.pause
{
let skView = self.view as SKView
skView.paused = true
}
}
}
當我觸摸暫停按鈕沒有任何反應...... 出了什麼問題?
謝謝!