2-star challenge: completing the tutorial

You may have realized that the tutorial reappears every time we rerun the game even if it has been completed previously. Now that we know how to store information on the device, let's take advantage of it in order to store information about whether the tutorial has been completed.

Solution

We will need a couple of new variables to support this new behavior. Therefore, add the following lines at the top of GameScene class:

private var isTutorialCompleted: Bool = false
private var kUserDefaultTutorialCompleted = "user_default_tutorial_completed"

We declared a Boolean variable that will act as a flag that represents the user's default value. We also declared a constant that will be used to identify the value ...

Get Getting Started with SpriteKit now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.