我正试图弄清楚如何使用SKScene的子类检测屏幕上任何位置的触摸,以便我可以转换。我该怎么做?
由于
答案 0 :(得分:0)
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
let location = touch.location(in: self)
print(location)
//if your touch location = a button or anything it transitions to a new scene
if location = //Startbutton {
let transition = SKTransition.reveal(with: .down, duration: 0.75)
let gameScene = GameScene(size: size)
gameScene.scaleMode = scaleMode
view?.presentScene(gameScene, transition: transition)
打印用户触摸位置...希望有点帮助m8