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 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.