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
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Cocos2d Game Development Blueprints

You're reading from   Cocos2d Game Development Blueprints Design, develop, and create your own successful iOS games using the Cocos2d game engine

Arrow left icon
Product type Paperback
Published in Jan 2015
Publisher
ISBN-13 9781783987887
Length 440 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Jorge Jord√°n Jorge Jord√°n
Author Profile Icon Jorge Jord√°n
Jorge Jord√°n
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Sprites, Sounds, and Collisions 2. Explosions and UFOs FREE CHAPTER 3. Your First Online Game 4. Beat All Your Enemies Up 5. Scenes at the Highest Level 6. Physics Behavior 7. Jump and Run 8. Defend the Tower Index

Summary

At the beginning of this chapter, we had our first contact with a Cocos2d project. We created a new project and took an overview of it, understanding some of the classes that are part of this framework.

Then we were introduced to CCNode, one of the main classes, as it's the class parent for some of the most important objects we will use when developing games. Also, we showed how the scene graph should look, with a parent CCScene node as root and the different children nodes hanging from it.

You learned how to create a scene and add sprites to it, taking into account their anchor point to position them in the desired place. You also learned to add a background image with a customized z-order to be sure it lies behind the rest of the nodes.

I explained to you the characteristics to bear in mind when developing a game for both iPhone and iPad devices, such as screen resolution and relative positions.

Then you enabled user interaction to handle touches, which you used to know where to move the yeti using the CCActionMoveTo action. At the same time, you learned how to keep a sprite within the screen limits.

You learned how to set up a bunch of enemies, snowballs in this case, in an array, initializing their positions to keep them out of view waiting to attack. At this point, you learned how to get one snowball randomly and to apply a horizontal movement until it reached the right-hand edge of the screen.

Also, you handled the collisions between the snowballs and the yeti and took advantage of it to create a tint and blink action to execute when a collision happens.

To give some playability to the game, you learned how to place labels using their anchor points and how to initialize and update their text.

Toward the end of the chapter, you learned where you can get some audio sources and how you can create your own. Once you had the background music and the sound effects, you learned how to use them in your game.

In the last section of the chapter, you learned how to declare a condition to finish the game and which actions are needed to illustrate the game is over.

Now that we know how to load and move sprites, let's take them further to create complex objects and realistic effects.

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