Book Image

Cocos2d Game Development Essentials

Book Image

Cocos2d Game Development Essentials

Overview of this book

Table of Contents (13 chapters)

Creating Flappy Square


Let's start creating what is sure to be the next big hit on the App Store: Flappy Square. Flappy Square is a Flappy Bird clone that uses squares instead of fancy graphics. Don't worry! you will add some proper assets in the next chapter.

You should currently have a screen that looks like the following screenshot; if you don't move your label so it is in the same position and change its text:

  1. This screen will be the menu scene of the app. Let's add a button so that players can actually start the game.

  2. Drag a button from the left-hand side of SpriteBuilder onto your scene.

  3. Position the button at the center of the scene and change its text to Start Game.

  4. Now to add the code that will run when this button is pressed, you need to add a code connection.

  5. In the options pane, open the second tab on the right-hand side of the screen. In the field marked selector, type start.

  6. This is the method that Cocos2d will attempt to call when you tap on the button. Currently, this method does...