Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
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
Karan Sequeira Karan Sequeira
Author Profile Icon Karan Sequeira
Karan Sequeira
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

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

The Penguin class


The Penguin class publicly inherits from CCSprite and it is similar in terms of structure to the GameObject class you saw in the previous chapter. It possesses a b2Body object along with functions that update its position based on its body. The body of the penguin will have a circle-shaped fixture applied to it. We will skip all of that boilerplate code and discuss the behavior of the penguin.

Penguin behavior

Description

Awake

The penguin will be asleep at the start of the game. The player will have to touch the screen to wake him up.

Diving

This is true as long as the player is tapping the screen. A downward force is constantly applied to the penguin so long as he is diving.

Flying

This is true when the penguin is airborne and false when he is sliding on the surface of the hill.

Perfect slide

When the penguin launches off a slope above a certain velocity, it's a perfect slide.

Fever

The penguin enters into a trance like fever when he does three perfect slides...

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 $19.99/month. Cancel anytime
Banner background image