私は2つのシーン、FarmSceneとWoodSceneがあるゲームを持っています。 各シーンには.SKSファイルと.swiftファイルがあります。設計するものとコード化するものです。私の以前のゲームで別の.SKSファイルに移動する正しい方法
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
for touch in touches {
let location = touch.location(in: self)
let node : SKNode = self.atPoint(location)
if node.name == "WoodIcon" {
if let view = self.view as! SKView? {
// Load the SKScene from 'GameScene.sks'
if let scene = SKScene(fileNamed: "WoodScene") {
// Set the scale mode to scale to fit the window
scene.scaleMode = .aspectFill
// Present the scene
view.presentScene(scene)
}
}
}
}
}
私は別のシーンに移動するためにSKTransitionを使用しました、そしてそれを私はフリップのようないくつかのクールな遷移を行うことができ、フェード:私はこのようなWoodSceneにFarmSceneから移動することができた 押してください。
Xcodeでシーンデザイナを使用しているときに、これがシーンを変更する「正しい」方法であるかどうか疑問に思っていましたか?それとも、私は何かを逃しています。
お待ちしております。