Building Android Games with Cocos2d-x

Learn to create engaging and spectacular games for Android using Cocos2d-x

Building Android Games with Cocos2d-x

This ebook is included in a Mapt subscription
Raydelto Hernandez

Learn to create engaging and spectacular games for Android using Cocos2d-x
$0.00
$10.00
$24.99
$29.99p/m after trial
RRP $19.99
RRP $24.99
Subscription
eBook
Print + eBook
Start 30 Day Trial
Subscribe and access every Packt eBook & Video.
 
  • 4,000+ eBooks & Videos
  • 40+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 
Preview in Mapt

Book Details

ISBN 139781785283833
Paperback160 pages

Book Description

Cocos2d-x is a multi-platform C++ gaming framework in active development maintained by Chukong technologies. It wraps all the essential elements needed for creating a game, making the task of game building very developer-friendly.

Starting with a vital primer to get you up and running with your development environment, you will quickly dive in to exploring the latest version of this framework. You will understand major framework improvements to render objects at lightning speed, extend and maintain code easily, and improve the label API to add great functionality such as glow, shadows, and outlines to labels.

Through the creation of a real game, you will explore the core components of development including Physics, enabling you to create realistic sprite movements, and particle systems to dynamically simulate explosions, fire, rain, and smoke, as well as exploring the sound engine to make your game more robust. Finish by integrating Cocos2d-x C++ code with native Android code to launch games with the classic Java Android application.

Table of Contents

Chapter 1: Setting Up Your Development Environment
Cocos2d-x overview
Setting up Java
Setting up the Android SDK
Setting up the Android Native Development Kit
Setting up Apache Ant
Setting up Python
Setting up Cocos2d-x
Template code walk-through
Summary
Chapter 2: Graphics
Creating scenes
Pausing the game
Understanding nodes
Understanding sprites
Understanding actions
Animating sprites
Game menus
Putting everything together
Summary
Chapter 3: Understanding Game Physics
Setting up the physics world
Collision detection
Handling gravity
Putting everything together
Summary
Chapter 4: User Input
Understanding the Event Dispatcher mechanism
Handling the touch event
Handling accelerometer events
Keeping the screen alive
Handling the Android back key pressed event
Putting everything together
Summary
Chapter 5: Handling Text and Fonts
Creating TrueType font labels
Creating system fonts
Creating bitmap font labels
Putting everything together
Summary
Chapter 6: Audio
Playing background music and sound effects
Modifying audio properties
The new audio engine
Adding a mute button to our game
Putting everything together
Summary
Chapter 7: Creating Particle Systems
Creating collections of the Cocos2d-x objects
Adding particle systems to our game
Configuring the particle systems
Creating customized particle systems
Putting everything together
Summary
Chapter 8: Adding Native Java Code
Understanding the Cocos2d-x structure for the Android platform
Understanding the JNI capabilities
Adding Java code to the Cocos2d-x game
Adding ads to the game by inserting Java code
Configuring the environment
Modifying the Android manifest
Putting everything together
Summary

What You Will Learn

  • Set up your work environment
  • Learn how to create graphic elements and animate them
  • Use the built-in physics engine to make your games more realistic
  • Manage user interaction using the touch and accelerometer capabilities
  • Boost your game's visual appeal by learning to add text and using true type and bitmap fonts
  • Enhance your game by adding sound effects and background music
  • Discover how to add rich explosion effects using particle systems
  • Add native Java code to your Android game

Authors

Table of Contents

Chapter 1: Setting Up Your Development Environment
Cocos2d-x overview
Setting up Java
Setting up the Android SDK
Setting up the Android Native Development Kit
Setting up Apache Ant
Setting up Python
Setting up Cocos2d-x
Template code walk-through
Summary
Chapter 2: Graphics
Creating scenes
Pausing the game
Understanding nodes
Understanding sprites
Understanding actions
Animating sprites
Game menus
Putting everything together
Summary
Chapter 3: Understanding Game Physics
Setting up the physics world
Collision detection
Handling gravity
Putting everything together
Summary
Chapter 4: User Input
Understanding the Event Dispatcher mechanism
Handling the touch event
Handling accelerometer events
Keeping the screen alive
Handling the Android back key pressed event
Putting everything together
Summary
Chapter 5: Handling Text and Fonts
Creating TrueType font labels
Creating system fonts
Creating bitmap font labels
Putting everything together
Summary
Chapter 6: Audio
Playing background music and sound effects
Modifying audio properties
The new audio engine
Adding a mute button to our game
Putting everything together
Summary
Chapter 7: Creating Particle Systems
Creating collections of the Cocos2d-x objects
Adding particle systems to our game
Configuring the particle systems
Creating customized particle systems
Putting everything together
Summary
Chapter 8: Adding Native Java Code
Understanding the Cocos2d-x structure for the Android platform
Understanding the JNI capabilities
Adding Java code to the Cocos2d-x game
Adding ads to the game by inserting Java code
Configuring the environment
Modifying the Android manifest
Putting everything together
Summary

Book Details

ISBN 139781785283833
Paperback160 pages
Read More

Read More Reviews