Time for action – using the scroll view to select levels
It is nice to have good transitions from the menu, but currently, we can't even start the game since we display almost an empty scene for level selection. The reason for this whole scene is that in some games, you have multiple levels. I'm sure you can remember some popular game where you scroll between levels or game types.
Sometimes, the game can have so many levels that they don't fit on one screen. Of course, we could create different scenes and plan transitions just as we did on the menu scene, but in most cases, we just need a scroll view. This is exactly what we're going to do now; we're going to add a scroll view. Refer to the following steps:
Open the
LevelSelectScene.m
file, and import theGameScene.h
header since we're going to navigate to this scene for one of our levels:#import "GameScene.h"
Right after the
#import
directives, add two#define
statements. These will be our level names to distinguish them in the scroll view...