Cocos2d-x Cookbook

Over 50 hands-on recipes to help you efficiently administer and maintain your games with Cocos2d-x

Cocos2d-x Cookbook

This ebook is included in a Mapt subscription
Akihiro Matsuura

1 customer reviews
Over 50 hands-on recipes to help you efficiently administer and maintain your games with Cocos2d-x
$10.00
$44.99
RRP $35.99
RRP $44.99
eBook
Print + eBook
Access every Packt eBook & Video for just $100
 
  • 4,000+ eBooks & Videos
  • 40+ New titles a month
  • 1 Free eBook/Video to keep every month
Find Out More
 
Preview in Mapt

Book Details

ISBN 139781783284757
Paperback254 pages

Book Description

Cocos2d-x is a suite of open source, cross-platform game-development tools used by thousands of developers all over the world. Cocos2d-x is a game framework written in C++, with a thin platform-dependent layer. Completely written in C++, the core engine has the smallest footprint and the fastest speed of any other game engine, and is optimized to be run on all kinds of devices.

You will begin with the initial setup and installation of Cocos2d before moving on to the fundamentals needed to create a new project. You will then explore and create the sprites, animations, and actions that you will include in the game. Next you will look at strings and create labels, including a label with True Type Font (TTF) font support.

Later, you will learn about layer and scene creation and transition. Then you will create the GUI parts essential for a game, such as buttons and switches. After that, you will breathe life into the game with background music and sound effects using the all new Cocos2d-x audio engine. You will then discover how to manage resource files and implement processes that depend on the operating system.

Finally, you will polish your game with physics such as gravity and elevation, learn about tools that will help you make games more robust and stable, and get to know best practices to improve the game you have developed.

Table of Contents

Chapter 1: Getting Started with Cocos2d-x
Introduction
Setting up our Android Environment
Installing Cocos2d-x
Using the Cocos command
Building the project using Xcode
Building the project using Eclipse
Implementing multi-resolution support
Preparing your original game
Chapter 2: Creating Sprites
Introduction
Creating sprites
Getting the sprite's position and size
Manipulating sprites
Creating animations
Creating actions
Controlling actions
Calling functions with actions
Easing actions
Using a texture atlas
Using a batch node
Using 3D modals
Detecting collisions
Drawing a shape
Chapter 3: Working with Labels
Creating system font labels
Creating true type font labels
Creating bitmap font labels
Creating rich text
Chapter 4: Building Scenes and Layers
Introduction
Creating scenes
Transitioning between scenes
Transitioning scenes with effects
Making original transitions for replacing scenes
Making original transitions for popping scenes
Creating layers
Creating modal layers
Chapter 5: Creating GUIs
Introduction
Creating menus
Creating buttons
Creating checkboxes
Creating loading bars
Creating sliders
Creating text fields
Creating scroll views
Creating page views
Creating list views
Chapter 6: Playing Sounds
Playing background music
Playing a sound effect
Controlling volume, pitch, and balance
Pausing and resuming background music
Pausing and resuming sound effects
Playing background music and a sound effect by using AudioEngine
Playing movies
Chapter 7: Working with Resource Files
Selecting resource files
Managing resource files
Using SQLite
Using .xml files
Using .plist files
Using .json files
Chapter 8: Working with Hardware
Introduction
Using native code
Changing the processing using the platform
Using the acceleration sensor
Keeping the screen on
Getting dpi
Getting the maximum texture size
Chapter 9: Controlling Physics
Introduction
Using the physics engine
Detecting collisions
Using joints
Changing gravity by using the acceleration sensor
Chapter 10: Improving Games with Extra Features
Introduction
Using Texture Packer
Using Tiled Map Editor
Getting the property of the object in the tiled map
Using Physics Editor
Using Glyph Designer
Chapter 11: Taking Advantages
Introduction
Using encrypted sprite sheets
Using encrypted zip files
Using encrypted SQLite files
Creating Observer Pattern
Networking with HTTP

What You Will Learn

  • Install and set up Cocos2d-x for your development environment
  • Build, test, and release game applications for iOS and Android
  • Develop your games for multiple platforms
  • Customize Cocos2d-x for your games
  • Use a physical engine in your games
  • Save and load text, JSON, XML, or other formats
  • Explore the brand new features of Cocos2d-x

Authors

Table of Contents

Chapter 1: Getting Started with Cocos2d-x
Introduction
Setting up our Android Environment
Installing Cocos2d-x
Using the Cocos command
Building the project using Xcode
Building the project using Eclipse
Implementing multi-resolution support
Preparing your original game
Chapter 2: Creating Sprites
Introduction
Creating sprites
Getting the sprite's position and size
Manipulating sprites
Creating animations
Creating actions
Controlling actions
Calling functions with actions
Easing actions
Using a texture atlas
Using a batch node
Using 3D modals
Detecting collisions
Drawing a shape
Chapter 3: Working with Labels
Creating system font labels
Creating true type font labels
Creating bitmap font labels
Creating rich text
Chapter 4: Building Scenes and Layers
Introduction
Creating scenes
Transitioning between scenes
Transitioning scenes with effects
Making original transitions for replacing scenes
Making original transitions for popping scenes
Creating layers
Creating modal layers
Chapter 5: Creating GUIs
Introduction
Creating menus
Creating buttons
Creating checkboxes
Creating loading bars
Creating sliders
Creating text fields
Creating scroll views
Creating page views
Creating list views
Chapter 6: Playing Sounds
Playing background music
Playing a sound effect
Controlling volume, pitch, and balance
Pausing and resuming background music
Pausing and resuming sound effects
Playing background music and a sound effect by using AudioEngine
Playing movies
Chapter 7: Working with Resource Files
Selecting resource files
Managing resource files
Using SQLite
Using .xml files
Using .plist files
Using .json files
Chapter 8: Working with Hardware
Introduction
Using native code
Changing the processing using the platform
Using the acceleration sensor
Keeping the screen on
Getting dpi
Getting the maximum texture size
Chapter 9: Controlling Physics
Introduction
Using the physics engine
Detecting collisions
Using joints
Changing gravity by using the acceleration sensor
Chapter 10: Improving Games with Extra Features
Introduction
Using Texture Packer
Using Tiled Map Editor
Getting the property of the object in the tiled map
Using Physics Editor
Using Glyph Designer
Chapter 11: Taking Advantages
Introduction
Using encrypted sprite sheets
Using encrypted zip files
Using encrypted SQLite files
Creating Observer Pattern
Networking with HTTP

Book Details

ISBN 139781783284757
Paperback254 pages
Read More
From 1 reviews

Read More Reviews