0%

Book Description

Build a plethora of games for various genres using one of the most powerful game engines, Cocos2d-x

In Detail

Packed with comprehensive projects, this book takes a detailed look at a few of the industry's most popular games. This book will show you how to use Cocos2d-x to build games using its core components. You will learn how to incorporate game physics, and import custom models and animations. Next, you will see how to include effects such as particles and sounds. With a brief introduction to the upcoming HTML5 platform using Cocos2d-html5, the book goes on to tackle the many different concepts that comprise game development today. You will learn how to build worlds with meshes, a terrain, user interaction, physics, and more. You will start by developing a puzzle game, and then progress on to games that are increasingly complex. Along the way, you'll learn how to build gaming favorites similar to games such as Flappy Bird, Tilt to Live, Jumpy Clown, Angry Birds, and Tower Defense.

What You Will Learn

  • Take advantage of the open source nature of Cocos2d-x by extending the engine to customize and add your own features to it
  • Design games with level-based and time-based difficulty progression, which are very addictive and keeps users engaged
  • Maximize user interaction by implementing intuitive gestures and tilt controls
  • Implement advanced physics engine features such as PreSolve and PostSolve events
  • Add realism to your game by using a touch event, and use it to control a game
  • Implement circle-to-circle collision detection in your games
  • Build the same project on multiple platforms, such as Android and Windows, effortlessly

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 http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Cocos2d-x Game Development Blueprints
    1. Table of Contents
    2. Cocos2d-x Game Development Blueprints
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      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. A Colorful Start
      1. An overview of ColourSmash
      2. Setting up the environment for Cocos2d-html5
      3. Creating a project in Cocos2d-html5
      4. Getting acquainted with the project structure
      5. Creating the first scene – the main menu
      6. Moving on to the game world
        1. Declaring and initializing the variables
        2. Creating the background
        3. Creating the tiles
        4. Creating the Heads-Up Display
        5. The countdown timer
        6. Let's get touchy...
        7. The core gameplay
          1. Finding the tiles
          2. Removing the tiles
          3. Finding and shifting tiles from above
          4. Adding new tiles
          5. Adding score and bonus
          6. Updating the timer
      7. Summary
    9. 2. How to Fly a Dragon!
      1. Getting to know sprite sheets
      2. Creating a lively menu screen
      3. Creating a fairy tale
        1. Building an infinitely long castle in 20 lines of code
        2. Adding the stars
      4. Setting things into motion
      5. On to the game world
        1. The core gameplay
          1. Creating the dragon
          2. Creating the towers
          3. The update loop
          4. Updating the dragon
          5. Updating the towers
          6. Collision detection
        2. Flying the dragon
        3. Farewell dear dragon
      6. Saving a high score using LocalStorage
      7. Let's make some HTML5 noise
      8. Summary
    10. 3. Not Just a Space Game
      1. An overview of SpaceCraze
      2. Creating a project
      3. Defining the global variables of the game
      4. Creating your own Sprite
      5. On to the game world...
        1. The Player class
        2. The Enemy class
        3. The Brick class
        4. Parsing the level file
        5. Creating enemies
        6. Creating bricks
        7. Creating the player
        8. Creating HUD elements
        9. The start and stop functions
        10. Moving the enemies
        11. Fire the bullets!
        12. The update function
        13. Checking for collisions
        14. Touch controls
        15. Level complete and game over
      6. Summary
    11. 4. Back to the Drawing Board
      1. An introduction to Inverse Universe
      2. The CCDrawNode class
      3. Figuring out the geometry
      4. Defining the elements of Inverse Universe
        1. The Player class
        2. The Enemy class
        3. The PowerUp class
        4. The Bomb class
        5. The Blast class
        6. The MissileLauncher class
        7. The Missile class
        8. The Shield class
      5. Creating the game
      6. The update loop
      7. Adding tilt controls
      8. Moving the player
      9. Adding progression and difficulty levels
      10. Summary
    12. 5. Let's Get Physical!
      1. An overview of Jumpy Clown
      2. The basics of Box2D
      3. Creating the world
      4. Using debug draw
      5. Stepping into the world
      6. Creating the GameObject class
      7. Creating the walls
      8. Creating the base
      9. Creating the clown
      10. Defining the clown's state machine
      11. Creating the platform
      12. Adding and removing platforms
      13. Adding the controls
      14. Listening for collisions
      15. The Collectible class
      16. Creating and reusing collectibles
      17. The update loop
      18. Summary
    13. 6. Creativity with Textures
      1. An introduction to Penguins Can Fly
      2. The Terrain class
        1. Generating the striped texture
          1. Drawing the stripes
          2. Adding a gradient
          3. Adding some highlight
          4. Drawing the border
          5. Adding some noise
        2. Generating the hills
          1. Generating the hill key points
          2. Generating the curve of the hill
          3. Creating the Box2D body for the hill
        3. Rendering the hills
        4. Updating the hill
      3. The Penguin class
        1. Updating the penguin
      4. On to the game world
      5. Summary
    14. 7. Old is Gold!
      1. An introduction to Iceman
      2. What is a tile-based game?
      3. What is the Tiled Map Editor?
        1. Creating a new tile map
        2. Adding a tileset
        3. Adding a tile layer
        4. Adding an objects layer
      4. Tile-based collision detection
      5. The GameObject class
      6. The Hero class
      7. The Enemy class
      8. Collisions with moving platforms and enemies
      9. Summary
    15. 8. Box2D Meets RUBE
      1. An introduction to Angry Fish
      2. A brief introduction to RUBE
        1. Creating bodies
        2. Running the scene
        3. Importing images
      3. Creating a level with RUBE
        1. Creating the catapult
        2. Adding custom properties
      4. Generating a world using data exported from RUBE
      5. Defining the fish
        1. The Fish class
        2. The ShootingFish class
        3. The SplittingFish class
        4. The ExplodingFish class
          1. Using Box2D's RayCast
        5. The Cat class
          1. The PostSolve function
      6. Creating and spawning the fish
      7. Creating a mouse joint
      8. Summary
    16. 9. The Two Towers
      1. Introduction to Pumpkin Defense
      2. Defining the properties of the tower
      3. Defining the properties of the enemy
      4. Defining the XML file for a level
      5. Designing the level in Tiled
      6. The Tower class
      7. The Lightning class
      8. The Enemy class
      9. Spawning waves of enemies
      10. The GestureLayer class
      11. Spawning the towers
      12. Fast forwarding the gameplay
      13. Summary
    17. 10. Cross-platform Building
      1. Setting up the environment for Android
        1. Java Development Kit 7+
        2. The Android SDK
        3. Eclipse or the ADT bundle
        4. ADT plugin for Eclipse
        5. Installing Cygwin for Windows
        6. The Android NDK
      2. Building Pumpkin Defense on Android
      3. Creating an Android Virtual Device
      4. Running Pumpkin Defense on Android
      5. Setting up the environment for Windows Phone 8
      6. Building Pumpkin Defense on Windows Phone 8
      7. What to do next?
      8. Summary
    18. Index
3.149.29.71