O'Reilly logo

Learning iOS 8 Game Development Using Swift by Siddharth Shekar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding a main menu scene

Let us make some changes to the GameScene class to make it our main menu scene:

  1. Rename the file to MainMenuScene.swift by selecting the file in the project hierarchy in the project navigator.
  2. Change the name of the class in the file to MainMenuScene.
  3. Delete all the lines of code inside didMoveToView.
  4. In the touchesBegan function, delete the code related to the adding of the sprite and the running of the action upon it.
  5. Delete the update function as it is not required for the main menu scene. If required, we will add it later.

The MainMenuScene.swift file should look like the following code snippet, as we deleted all the code from the didMoveToView function and modified the touchedBegan function:

import SpriteKit class MainMenuScene: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required