Creating a main menu

When playing mobile games, you will usually find an initial menu screen when you run it. These screens are usually shown to provide players with a way to modify some configurations, such as turning on or turning off of the game sound, the selection of a game's difficulty, or just a way to hide a big load of components.

We are going to create a menu that will be shown when the game is run, where we will show a background and a button to start playing the game.

For this purpose, we will need to create a new scene file to manage this new screen behavior. To do so, perform the following steps:

  1. In Xcode, select the File menu at the top of the screen.
  2. Select New | File, and you will see the Files dialog box.
  3. Select the Swift File option ...

Get Getting Started with SpriteKit 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.