Present the Title Scene

You’ve already seen the title scene for Val’s Revenge, now it’s time to let the player see it. For that to happen, you’ll need to make some adjustments to the existing code.

Switch to the GameViewController.swift file and update the viewDidLoad() method to match this:

 override​ ​func​ ​viewDidLoad​() {
 super​.​viewDidLoad​()
 
 // Create the view
 if​ ​let​ view = ​self​.view ​as!​ ​SKView​? {
 
 // Create the scene
 let​ scene = ​TitleScene​(fileNamed: ​"TitleScene"​)
 
 // Set the scale mode to scale to fill the view window
  scene?.scaleMode = .aspectFill
 
 // Present the scene
  view.​presentScene​(scene)
 
 // Set the view options
  view.ignoresSiblingOrder = ​false
  view.showsPhysics = ​false
  view.showsFPS = ​false
  view.showsNodeCount = ​false
  }
 }

With this update, instead of loading the game scene as the initial scene, you’re now loading the title scene. Before you build and run the project, let’s get the first game scene working, too.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset