Learning Cocos2d-x Game Development

Learn cross-platform game development with Cocos2d-x

Learning Cocos2d-x Game Development

Learning
Siddharth Shekar

Learn cross-platform game development with Cocos2d-x
$10.00
$44.99
RRP $26.99
RRP $44.99
eBook
Print + eBook
$12.99 p/month

Get Access

Get Unlimited Access to every Packt eBook and Video course

Enjoy full and instant access to over 3000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

+ Collection
Free Sample

Book Details

ISBN 139781783988266
Paperback266 pages

About This Book

  • Create a Windows Store account and upload your game for distribution
  • Develop a game using Cocos2d-x by going through each stage of game development process step by step

Who This Book Is For

If you are a hobbyist, novice game developer, or programmer who wants to learn about developing games/apps using Cocos2d-x, this book is ideal for you.

Table of Contents

Chapter 1: Getting Started
Downloading and installing Visual Studio
Downloading and installing the Windows Phone SDK
Downloading and installing Python
Downloading Cocos2d-x
Creating a new project
Coordinate system
Basic classes of Cocos2d-x
Project breakup
Running the project on multiple platforms
Summary
Chapter 2: Displaying the Hero and Controls
First things first
Displaying the background image
Character movement
Enabling the touch function
Enabling multitouch
Movement with touches
Movement with the accelerometer
Custom controls
Summary
Chapter 3: Enemies and Controls
Creating the enemy class
Adding the gameplay layer
Creating the projectile class
Adding hero controls
Summary
Chapter 4: Collision Detection and Scoring
Theory of collision detection
Coding collision detection
Keeping track of the score and the game over condition
Storing high scores
Summary
Chapter 5: HUD, Parallax Background, and the Pause Button
Texts and fonts
Creating the HUD layer and displaying as well as updating scores
Creating the pause button and showing the pause screen
Implementing pause and resuming the game
Adding the scrolling layer class
Creating the parallax scrolling layer
Summary
Chapter 6: Animations
Animation basics
TexturePacker
Creating a spritesheet for the player
Coding the player animation
Creating and coding enemy animation
Creating the skeletal animation
Coding the player walk cycle
Summary
Chapter 7: Particle Systems
What is a particle system?
Cocos2d-x's inbuilt particle system
Adding the gun muzzle particle system
Adding an explosion particle system
Adding particles for jetpack when a player moves upwards
Creating your own particle system
Summary
Chapter 8: Adding Main and Option Menu Scenes
Creating the main menu scene
Loading the menu scene at start of the app
Creating the Options scene
Changing the name of the app
Summary
Chapter 9: Adding Sounds and Effects
Audio in Cocos2d-x
Adding looped background music
Adding sound effects
Adding the mute button
Summary
Chapter 10: Publishing to the Windows Phone Store
A look at the Windows Phone Store
Creating the store account
Preparing/creating the app
Creating the app and setting pricing
Uploading the XAP file, icons, and screenshots for review
Summary
Chapter 11: Porting, References, and Final Remarks
Running the game on the Windows desktop
Running the game on the Android simulator using the Eclipse IDE
Running on the BlackBerry simulator using the Momentics IDE
Running on an iOS simulator using Xcode
Additional learning resources
Final remarks and a thank you note

What You Will Learn

  • Configure and create a Cocos2d-x project on Windows
  • Understand the basics of Cocos2d-x classes such as CCScene, CCLayer, and CCSprite
  • Develop different control schemes using buttons, a gyroscope, and a custom touch area
  • Implement various methods for collision detection such as circle collision and bounding box collision
  • Discover how to add and remove objects from the screen and update the score as well as Gameover condition
  • Get to grips with the tools used to create spritesheets as well as custom fonts and design particles
  • Integrate ads and in-app purchases in the game to monetize the game

In Detail

Cocos2d-x is one of the most popular cross-platform 2D game engines. It is packed with powerful features that set it apart from other game engines. With so many languages and operating systems, Cocos2d-x provides a one-stop solution for developing games for the operating system of your choice using the language you are most comfortable with. Starting from the basics, this book will show you how to display content on the screen and make it interact as well as move around with various control mechanisms such as actions, accelerometer, and tap onscreen buttons. You will learn about the mechanics of collision detection, their advantages and disadvantages, and how to keep track of the score. You will then create a gameplay cycle, use third-party tools to expedite the development process, and distribute the game through the App Store.

By working through the carefully designed chapters of the book, you will master Cocos2d-x and the various tools so that you can use these skills to make a complete game or a quick prototype.

Authors

Table of Contents

Chapter 1: Getting Started
Downloading and installing Visual Studio
Downloading and installing the Windows Phone SDK
Downloading and installing Python
Downloading Cocos2d-x
Creating a new project
Coordinate system
Basic classes of Cocos2d-x
Project breakup
Running the project on multiple platforms
Summary
Chapter 2: Displaying the Hero and Controls
First things first
Displaying the background image
Character movement
Enabling the touch function
Enabling multitouch
Movement with touches
Movement with the accelerometer
Custom controls
Summary
Chapter 3: Enemies and Controls
Creating the enemy class
Adding the gameplay layer
Creating the projectile class
Adding hero controls
Summary
Chapter 4: Collision Detection and Scoring
Theory of collision detection
Coding collision detection
Keeping track of the score and the game over condition
Storing high scores
Summary
Chapter 5: HUD, Parallax Background, and the Pause Button
Texts and fonts
Creating the HUD layer and displaying as well as updating scores
Creating the pause button and showing the pause screen
Implementing pause and resuming the game
Adding the scrolling layer class
Creating the parallax scrolling layer
Summary
Chapter 6: Animations
Animation basics
TexturePacker
Creating a spritesheet for the player
Coding the player animation
Creating and coding enemy animation
Creating the skeletal animation
Coding the player walk cycle
Summary
Chapter 7: Particle Systems
What is a particle system?
Cocos2d-x's inbuilt particle system
Adding the gun muzzle particle system
Adding an explosion particle system
Adding particles for jetpack when a player moves upwards
Creating your own particle system
Summary
Chapter 8: Adding Main and Option Menu Scenes
Creating the main menu scene
Loading the menu scene at start of the app
Creating the Options scene
Changing the name of the app
Summary
Chapter 9: Adding Sounds and Effects
Audio in Cocos2d-x
Adding looped background music
Adding sound effects
Adding the mute button
Summary
Chapter 10: Publishing to the Windows Phone Store
A look at the Windows Phone Store
Creating the store account
Preparing/creating the app
Creating the app and setting pricing
Uploading the XAP file, icons, and screenshots for review
Summary
Chapter 11: Porting, References, and Final Remarks
Running the game on the Windows desktop
Running the game on the Android simulator using the Eclipse IDE
Running on the BlackBerry simulator using the Momentics IDE
Running on an iOS simulator using Xcode
Additional learning resources
Final remarks and a thank you note

Book Details

ISBN 139781783988266
Paperback266 pages
Read More