Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Cocos2d-x by example (update)
  • Table Of Contents Toc
Cocos2d-x by example (update)

Cocos2d-x by example (update)

By : Roger Engelbert
4.9 (10)
close
close
Cocos2d-x by example (update)

Cocos2d-x by example (update)

4.9 (10)
By: Roger Engelbert

Overview of this book

If you are a game enthusiast who would like to develop and publish your own game ideas onto different app stores, this is the book for you. Some knowledge of C++ or Java is helpful but not necessary.
Table of Contents (14 chapters)
close
close
13
Index

Time for action – adding a tutorial

Let's move back to our createGameScreen method.

  1. 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);
  2. 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 than kGameTutorial, 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.

  3. If you...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Cocos2d-x by example (update)
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon