我正在逐步关注这个问题How to create a main menu for a spritekit game made with swift in xcode?。
我创建了一个SKScene和一个Cocoa Touch Class,并在Cocoa Touch Class中插入了这个:
SELECT value,
COALESCE(lag(new_value) OVER () * value, 10) AS new_value
FROM table
现在在GameViewController文件中我试图从import SpriteKit
class MenuScene: SKScene {
var playButton = SKSpriteNode()
let playButtonTex = SKTexture(imageNamed: "play")
override func didMove(to view: SKView) {
playButton = SKSpriteNode(texture: playButtonTex)
playButton.position = CGPoint(x: frame.midX, y: frame.midY)
self.addChild(playButton)
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
if let touch = touches.first {
let pos = touch.location(in: self)
let node = self.atPoint(pos)
if node == playButton {
if let view = view {
let transition:SKTransition = SKTransition.fade(withDuration: 1)
let scene:SKScene = GameScene(size: self.size)
self.view?.presentScene(scene, transition: transition)
}
}
}
}
}
更改为if let scene = GameScene.unarchiveFromFile("GameScene") as?
。
但是我一直收到这个错误。请帮助!
这是我的代码
if let scene = MenuScene.unarchiveFromFile("MenuScene") as? Menu Scene