Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Cocos2d-X Game Development Blueprints

You're reading from   Cocos2d-X Game Development Blueprints Build a plethora of games for various genres using one of the most powerful game engines, Cocos2d-x

Arrow left icon
Product type Paperback
Published in Jul 2015
Publisher Packt
ISBN-13 9781783985265
Length 392 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
 Sequeira Sequeira
Author Profile Icon Sequeira
Sequeira
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Cocos2d-x Game Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. A Colorful Start FREE CHAPTER 2. How to Fly a Dragon! 3. Not Just a Space Game 4. Back to the Drawing Board 5. Let's Get Physical! 6. Creativity with Textures 7. Old is Gold! 8. Box2D Meets RUBE 9. The Two Towers 10. Cross-platform Building Index

On to the game world...


We have a lot of work to do, so let's quickly list the main tasks at hand:

  • Create

    • Create the level by parsing an XML file containing level data

    • Create the player

    • Create the HUD

  • Move the enemies

  • Update

    • Fire player and enemy bullets

    • Collision detection

    • Level completion and game over conditions

However, before we complete all these tasks, we need to define the classes for our three major game play entities: player, enemy, and brick.

The Player class

Our Player entity inherits from CustomSprite and can die and come back to life, but only twice. The third time it dies, the game is over! Let's take a look at the significant functions that make our Player entity brave and enduring:

void Player::Enter()
{
  // initially position the player below the screen
  setPosition(ccp(SCREEN_SIZE.width * 0.5, SCREEN_SIZE.height * -0.1));

  // animate the move into the screen
  CCActionInterval* movement = CCEaseBackOut::create(CCMoveTo::create(
  1.0f, ccp(SCREEN_SIZE.width * 0.5, SCREEN_SIZE.height...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images