Switch to the store?

Cocos2d-X by Example Beginner's Guide

More Information
Learn
  • Make your games look cooler with particle effects
  • Create place holder sprites to quickly test your game ideas
  • Load external data into your games
  • Build game menus and tutorials
  • Implement game-wide events with notifications
  • Create a dash game with a textured terrain
  • Build a Box2D puzzle game with multiple levels
  • Create a hybrid iOS and Android project
About

Cocos2d-x is the C++ port of arguably the most popular open source 2D framework in the world. Its predecessor was limited to the Apple family but with Cocos2d-x you can take your applications to all major app stores, with minimum extra work. Give your games a larger target audience with almost no extra hassle.

"Cocos2d-X by Example Beginner's Guide" allows you to build your own cross platform games using all the benefits of a time tested framework, plus the elegance and simplicity of C++.

Each of the six games developed in this book will take you further on the road to becoming an expert game developer with no fuss and plenty of fun.

Follow six tutorials for six very different games that leverage the ease of Cocos2D-X and its quick implementation, moving from simple ideas to more advanced topics in game development.

In easy-to-follow steps, the book teaches you how to take full advantage of the framework by adding animations and special effects, implementing a physics engine, and optimizing your games.

Prepare your project for multiple platforms and learn how to take your game concepts to completion.

"Cocos2d-X by Example Beginner's Guide" will present to you, in six different games, the topics necessary to build some of the most popular and fun types of games today.

Features
  • Learn to build multi-device games in simple, easy steps, letting the framework do all the heavy lifting
  • Spice things up in your games with easy to apply animations, particle effects, and physics simulation
  • Quickly implement and test your own gameplay ideas, with an eye for optimization and portability
  • Enjoy building the games as much as you will enjoy playing them
Page Count 246
Course Length 7 hours 22 minutes
ISBN9781782167341
Date Of Publication 24 Apr 2013
Download and installation
Time for action – downloading and installing Cocos2d-x
Hello-x World-x
Time for action – creating an application
Further information
Time for action – running the test samples
The other tools
Summary
Cocos2d-x – an introduction
The interface
Time for action – creating the interface
The implementation
Time for action – creating the implementation
Instantiation and memory management
What you get with CCObject
Summary
Game configurations
Time for action – creating your game project
Time for action – laying down the rules
Supporting retina displays
Time for action – adding the image files
Time for action – adding retina support
Adding sound effects
Time for action – adding the sound files
Extending CCSprite
Time for action – adding GameSprite.cpp
Time for action – implementing GameSprite
The actual game scene
Time for action – coding the GameLayer interface
Time for action – implementing init()
Time for action — handling multi-touches
Time for action – adding our main loop
Time for action – updating scores
Summary
The game – Sky Defense
Using sprite sheets in Cocos2d-x
Time for action – creating a CCSpriteBatchNode
Bitmap fonts in Cocos2d-x
Time for action – creating bitmap font labels
Time for action – adding the final screen sprites
Time for action – creating our object pools
CCActions in a nutshell
Time for action – creating actions with Cocos2d-x
Animating a sprite in Cocos2d-x
Time for action – creating animations
Time to make our game tick!
Time for action – handling touches
Time for action – starting and restarting the game
Time for action – updating the game
Time for action – retrieving objects from the pool
Play the game!
Summary
The game – Rocket Through
So what are particles?
Time for action – creating particle systems
Creating the grid
Drawing primitives in Cocos2d-x
Time for action – let's do some drawing!
The Rocket sprite
Time for action – updating our Rocket
Time for Action – handling touches
The game loop
Time for action – adding the main loop
Kill and reset
Time for action – adding our resets and kills
Summary
The game – Victorian Rush Hour
The game settings
Rapid prototyping with Cocos2d-x
Time for action – creating placeholder sprites
The Player object
The Block object
The Terrain object
Time for action – coding the player
Time for action – coding the Block object
Time for action – initialising our Terrain class
Time for action – initializing our Blocks
Time for action – moving and resetting
Platform collision logic
Time for action – adding collision detection
Adding the controls
Time for action – handling touches
Time for action – coding the main loop
Summary
Victorian Rush Hour – the game
Texturing our buildings with CCSprites
Time for action – texturing the buildings
Containers within containers
Creating a parallax effect
Time for action – creating a parallax effect
Adding a menu to our game
Time for action – creating CCMenu and CCMenuItem
Adding a tutorial to our game
Time for action – adding a tutorial
Summary
Creating a Box2D project with Cocos2d-x
Time for action – preparing the basic template
So what is a physics engine?
Our game – MiniPool
Time for action – adding the touch events
Time for action – adding the main loop
Time for action – creating a timer
Summary
The game – Eskimo
Using CCScenes in Cocos2d-x
Time for action – creating a CCScene transition
Time for action – creating transitions with a singleton CCLayer
Loading external data from a .plist file
Time for action – creating a .plist file
Time for action – retrieving data from the .plist file
Saving game data
Time for action – storing the completed levels
Using notifications in your game
Time for action – using CCNotificationCenter
Using the accelerometer
Time for action – reading accelerometer data
Reusing b2Bodies
Time for action – changing a b2Body fixture
Summary
First, a word on versions and requirements
Time for action – creating an Android project with Cocos2d-x
Time for action – compiling the code
Using Eclipse
Time for action – installing the C++ compiler
Time for action – adding the Cocos2d-x library to Eclipse
Time for action – opening the project in Eclipse
Compiling C++ code in Eclipse
Time for action – compiling our C++ code
Creating a hybrid project
Time for action – creating a hybrid Cocos2d-x project
Creating a Box2D hybrid project
Time for action – creating a Box2D project
Developing a hybrid game
Summary

Authors

Roger Engelbert

Roger Engelbert is a game developer, with over 10 years of experience developing online games. He grew up surrounded by video games and thinks of classic, 8-bit, arcade titles as a form of art. He is the author behind the blog Done With Computers, which is chock-full of tutorials on game development and design. Roger sincerely hopes to soon live in a world where people of all ages will be given the knowledge and opportunity to experience the joy of building their own games.