Cocos2d-x by Example: Beginner's Guide - Second Edition

Unleash your inner creativity with the popular Cocos2d-x framework and learn how to build great cross-platform 2D games with this Cocos2dx tutorial
Preview in Mapt

Cocos2d-x by Example: Beginner's Guide - Second Edition

Roger Engelbert

Unleash your inner creativity with the popular Cocos2d-x framework and learn how to build great cross-platform 2D games with this Cocos2dx tutorial
Mapt Subscription
FREE
$29.99/m after trial
eBook
$25.20
RRP $35.99
Save 29%
Print + eBook
$44.99
RRP $44.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$25.20
$44.99
$29.99p/m after trial
RRP $35.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Cocos2d-x by Example: Beginner's Guide - Second Edition Book Cover
Cocos2d-x by Example: Beginner's Guide - Second Edition
$ 35.99
$ 25.20
Cocos2d-X by Example Beginner's Guide Book Cover
Cocos2d-X by Example Beginner's Guide
$ 26.99
$ 18.90
Buy 2 for $35.00
Save $27.98
Add to Cart
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 

Book Details

ISBN 139781785288852
Paperback270 pages

Book Description

Upgraded and updated, the powerful and popular open source cross-platform game development framework Cocos2d-x is better than ever. Through step-by-step tutorials you'll learn how to take complete advantage of Cocos2d-x, to take your game development skills - and projects - to the next level. You'll learn how to add animations and special effects to your games, implement a physics engine, optimize your games, prepare a project for multiple devices, and develop game ideas from the test version to a finished project.

Most importantly, this book provides you with the accumulated knowledge of thousands of game developers, all packed into one easy-to-use and proven framework that will save time and strenuous thinking! 

Table of Contents

Chapter 1: Installing Cocos2d-x
Downloading and installing Cocos2d-x
Time for action – downloading, downloading, downloading
Time for action – installing Cocos2d-x
Hello-x World-x
Time for action – creating an application
Time for action – deploying to Android
Finding more reference material
Time for action – running the test samples
The other tools
Summary
Chapter 2: You Plus C++ Plus Cocos2d-x
Cocos2d-x – an introduction
The class interface
Time for action – creating the interface
The class implementation
Time for action – creating the implementation
Instantiating objects and managing memory
What you get with Ref
Summary
Chapter 3: Your First Game – Air Hockey
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 Sprite
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 multitouches
Time for action – adding our main loop
Time for action – updating scores
Time for action – running the game in Android
Summary
Chapter 4: Fun with Sprites – Sky Defense
The game – sky defense
Using sprite sheets in Cocos2d-x
Time for action – creating SpriteBatchNode
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
Actions 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!
Time for action – running the game in Android
Summary
Chapter 5: On the Line – Rocket Through
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 sprite
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
Time for action – running the game in Android
Summary
Chapter 6: Quick and Easy Sprite – Victorian Rush Hour
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 – initializing our Terrain class
Time for action – initializing our Blocks object
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
Chapter 7: Adding the Looks – Victorian Rush Hour
Victorian Rush Hour – the game
Texturing our buildings with sprites
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 Menu and MenuItem
Adding a tutorial to our game
Time for action – adding a tutorial
Time for action – running the game in Android
Summary
Chapter 8: Getting Physical – Box2D
Building a Box2D project with Cocos2d-x
Time for action – using debug draw in your Box2D project
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
Time for action – running the game in Android
Summary
Chapter 9: On the Level – Eskimo
The game – Eskimo
Using scenes in Cocos2d-x
Time for action – creating a scene transition
Time for action – creating transitions with a singleton Layer class
Loading external data from a .plist file
Time for action – creating a .plist file
Loading the level data
Time for action – retrieving data from the .plist file
Saving game data
Time for action – storing the completed levels
Using events in your game
Time for action – using the event dispatcher
Using the accelerometer
Time for action – reading accelerometer data
Reusing b2Bodies
Time for action – changing a b2Body fixture
Time for action – running the game in Android
Summary
Chapter 10: Introducing Lua!
So what is Lua like?
The game – Stone Age
Time for action – creating or importing a project
Time for action – setting up our screen resolution
Time for action – creating a menu scene
Time for action – creating our game scene
Time for action – building the gems
Time for action – changing the grid with GridController
Time for action – swapping the gems and looking for matches
Time for action – collapsing the grid and repeating
Time for action – animating matches and collapses
Time for action – publishing the game with the Cocos IDE
Summary

What You Will Learn

  • Add time-saving and fun-looking animations to your projects
  • Make your games look cooler with particle effects
  • Draw lines, circles, and other primitives on the screen
  • Create place holder sprites to quickly test your game ideas
  • Load external data into your games
  • Create projects and deploy them to iOS and Android
  • Prepare your game for a variety of screen sizes and resolutions
  • Use the CocosIDE and the Lua bindings to develop a game

Authors

Table of Contents

Chapter 1: Installing Cocos2d-x
Downloading and installing Cocos2d-x
Time for action – downloading, downloading, downloading
Time for action – installing Cocos2d-x
Hello-x World-x
Time for action – creating an application
Time for action – deploying to Android
Finding more reference material
Time for action – running the test samples
The other tools
Summary
Chapter 2: You Plus C++ Plus Cocos2d-x
Cocos2d-x – an introduction
The class interface
Time for action – creating the interface
The class implementation
Time for action – creating the implementation
Instantiating objects and managing memory
What you get with Ref
Summary
Chapter 3: Your First Game – Air Hockey
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 Sprite
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 multitouches
Time for action – adding our main loop
Time for action – updating scores
Time for action – running the game in Android
Summary
Chapter 4: Fun with Sprites – Sky Defense
The game – sky defense
Using sprite sheets in Cocos2d-x
Time for action – creating SpriteBatchNode
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
Actions 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!
Time for action – running the game in Android
Summary
Chapter 5: On the Line – Rocket Through
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 sprite
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
Time for action – running the game in Android
Summary
Chapter 6: Quick and Easy Sprite – Victorian Rush Hour
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 – initializing our Terrain class
Time for action – initializing our Blocks object
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
Chapter 7: Adding the Looks – Victorian Rush Hour
Victorian Rush Hour – the game
Texturing our buildings with sprites
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 Menu and MenuItem
Adding a tutorial to our game
Time for action – adding a tutorial
Time for action – running the game in Android
Summary
Chapter 8: Getting Physical – Box2D
Building a Box2D project with Cocos2d-x
Time for action – using debug draw in your Box2D project
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
Time for action – running the game in Android
Summary
Chapter 9: On the Level – Eskimo
The game – Eskimo
Using scenes in Cocos2d-x
Time for action – creating a scene transition
Time for action – creating transitions with a singleton Layer class
Loading external data from a .plist file
Time for action – creating a .plist file
Loading the level data
Time for action – retrieving data from the .plist file
Saving game data
Time for action – storing the completed levels
Using events in your game
Time for action – using the event dispatcher
Using the accelerometer
Time for action – reading accelerometer data
Reusing b2Bodies
Time for action – changing a b2Body fixture
Time for action – running the game in Android
Summary
Chapter 10: Introducing Lua!
So what is Lua like?
The game – Stone Age
Time for action – creating or importing a project
Time for action – setting up our screen resolution
Time for action – creating a menu scene
Time for action – creating our game scene
Time for action – building the gems
Time for action – changing the grid with GridController
Time for action – swapping the gems and looking for matches
Time for action – collapsing the grid and repeating
Time for action – animating matches and collapses
Time for action – publishing the game with the Cocos IDE
Summary

Book Details

ISBN 139781785288852
Paperback270 pages
Read More

Read More Reviews

Recommended for You

Cocos2d-x Game Development Blueprints Book Cover
Cocos2d-x Game Development Blueprints
$ 39.99
$ 28.00
Cocos2d-X by Example Beginner's Guide Book Cover
Cocos2d-X by Example Beginner's Guide
$ 26.99
$ 18.90
Learning Unity 2D Game Development by Example Book Cover
Learning Unity 2D Game Development by Example
$ 26.99
$ 18.90
Cocos2d-x Cookbook Book Cover
Cocos2d-x Cookbook
$ 35.99
$ 25.20
Learning Cocos2d-x Game Development Book Cover
Learning Cocos2d-x Game Development
$ 26.99
$ 18.90
Cocos2d-x Game Development Essentials Book Cover
Cocos2d-x Game Development Essentials
$ 13.99
$ 9.80