Making the Game

With your newfound knowledge you can create your initial scene. You can start by opening up GameViewController.swift and removing some of the default code. Rewrite viewDidLoad to look like this:

var scene:SCNScene!override func viewDidLoad() {    super.viewDidLoad()    screenWidth = self.view.frame.size.width    screenHeight = self.view.frame.size.height    // create a new scene    scene = SCNScene()    // retrieve the SCNView    scnView = self.view as SCNView    // set the scene to the view    scnView.scene = scene    // allows the user to manipulate the camera    scnView.allowsCameraControl = true    // show statistics such as fps and timing information    scnView.showsStatistics = true    // configure ...

Get Learning Swift™ Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.