You are previewing Cocos2D Game Development Essentials.
O'Reilly logo
Cocos2D Game Development Essentials

Book Description

Bring your mobile game ideas to life with Cocos2D

In Detail

Focusing on the multiplatform nature of Cocos2D, this fast, fun, and helpful guide provides you with the best practices and sharpest techniques to turn your ideas into reality.

Beginning with the basics to give you a solid foundation of knowledge, such as how to display sprites on screen and organizing your game into different scenes, you will then discover how to use Cocos2D's in-built graphics editor, SpriteBuilder, to lay out your scenes, design animations, and configure complex physics interactions. You will also find out how to make your game interactive, as the book explores how to accept input touches and the accelerator.

The book is tailored to new users and also those who are upgrading from the old version.

What You Will Learn

  • Use sprites and nodes to create scenes to form the foundation of your game

  • Discover how SpriteBuilder and its graphical tools can be used to develop your game and increase its complexity

  • Design professional, impressive, and fun-filled animations

  • Create an impressive user interface for an engaging gaming experience

  • Explore and use physics engines for attractive gameplay and use them to add a professional finish to your game

  • Add physics to your game for a more realistic experience

  • Accept user input through a variety of methods including touch and accelerometer

  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

    Table of Contents

    1. Cocos2D Game Development Essentials
      1. Table of Contents
      2. Cocos2D Game Development Essentials
      3. Credits
      4. About the Author
      5. About the Reviewers
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      8. 1. Getting Started with Cocos2d
        1. An introduction to Cocos2d
        2. Installing Cocos2d
          1. Installing Cocos2d with the installer
            1. Creating a Hello World project
          2. Installation for Android
          3. Template project code breakdown
            1. IntroScene.m
            2. The HelloWorldScene.m class
        3. Summary
      9. 2. Nodes, Sprites, and Scenes
        1. The building blocks, nodes
          1. Children nodes
            1. Adding children
            2. Removing children
            3. Drawing order of the children nodes
            4. Working with multiple coordinate systems
          2. Sprites
        2. Putting it into practice
          1. Adding nodes to the scene
          2. Detecting touches and responding
        3. The next step
        4. The Cocos2d update loop
        5. Scenes
          1. Scene life cycle
          2. Creating a CCScene
          3. Transitioning to another scene
          4. Putting it into practice
        6. Summary
      10. 3. SpriteBuilder
        1. Creating a new project
          1. The Main editor window
          2. The Resource pane
          3. The Options pane
          4. The Timeline pane
        2. Creating Flappy Square
          1. Creating a new scene/layer
          2. Linking to a SpriteBuilder scene in code
          3. Enabling physics in SpriteBuilder
          4. Connecting SpriteBuilder objects to Xcode properties
          5. Creating reusable components
          6. Moving obstacles across the screen
          7. Detecting collisions
        3. The next step
        4. Summary
      11. 4. Animation with SpriteBuilder
        1. Adding sprites to SpriteBuilder
        2. Creating sprite frame animations
          1. Switching out the obstacle image
        3. Particle systems
          1. Designing a particle system for our character
          2. Adding a SpriteBuilder particle system in code
          3. Final polish to Flappy Bird
        4. Keyframe animation in SpriteBuilder
        5. Animation in code
          1. Moving, scaling, and rotating
          2. Chaining actions together
          3. Running actions simultaneously
          4. Repeating actions
          5. Running code on completion of an animation
        6. Summary
      12. 5. User Interaction and Interface
        1. Detecting touches
          1. Getting the touch location
            1. Dragging a node
        2. Adding buttons to your scene
        3. Accepting user input with form elements
        4. Presenting data in a table with CCTableView
          1. Creating a CCTableView data source
          2. Adding a CCTableView node to the scene
        5. Summary
      13. 6. Physics Engines
        1. Introducing physics engines
        2. Adding joints
        3. Adding a sprite joint
        4. Dragging an object against a spring joint
        5. Firing objects from the catapult
        6. Creating a motor
        7. The next step
        8. Summary
      14. Index