Time for action – adding a tutorial
Let's move back to our createGameScreen
method.
- Inside that method, add the following lines to create our
Label
object:_tutorialLabel = Label::createWithTTF("", "fonts/Times.ttf", 60); _tutorialLabel->setPosition(Vec2 (_screenSize.width * 0.5f, _screenSize.height * 0.6f) ); this->addChild(_tutorialLabel, kForeground); _tutorialLabel->setVisible(false);
- We add four states to our enumerated list of game states. These will represent the different steps in our tutorial:
typedef enum { kGameIntro, kGamePlay, kGameOver, kGameTutorial, kGameTutorialJump, kGameTutorialFloat, kGameTutorialDrop } GameState;
The first tutorial state,
kGameTutorial
, acts as a separator from all other game states. So, if the value for_state
is greater thankGameTutorial
, we are in tutorial mode.Now, depending on the mode, we display a different message and we wait on a different condition to change to a new tutorial state.
- If you...