Cocos2d Game Development Blueprints
eBook - ePub

Cocos2d Game Development Blueprints

Jorge Jordan

Share book
  1. 440 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Cocos2d Game Development Blueprints

Jorge Jordan

Book details
Book preview
Table of contents
Citations

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Cocos2d Game Development Blueprints an online PDF/ePUB?
Yes, you can access Cocos2d Game Development Blueprints by Jorge Jordan in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming Mobile Devices. We have over one million books available in our catalogue for you to explore.

Information

Cocos2d Game Development Blueprints


Table of Contents

Cocos2d Game Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
Cocos2d v3.0
Pure Objective-C
ARC
CCDirector
CCLayer
CCArray
OALSimpleAudio
CCAction
CCActionCallBlock
Sequences
Schedule update
Enabling touches
Accelerometer events
Physics
What this book covers
What you need for this book
Who this book is for
Conventions
1-star challenge – accurate collision detection
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Sprites, Sounds, and Collisions
Creating a new Cocos2d project
Run Xcode Run
Understanding the default project
CCNode
Your first game – RunYetiRun
Creating the CCScene class
Adding the first CCSprite class
Anchor points
Placing things in context
Time for CCAction
Actions under control
Throwing some snowballs
Rolling down the hill
Managing collisions
Adding labels
CCLabelTTF
Updating labels
Making some noise
OALSimpleAudio
Voice memos
Audacity
GarageBand
Audio resources
Playing audio files
Game over
1-star challenge – accurate collision detection
The solution
2-star challenge – having three lives
The solution
Summary
2. Explosions and UFOs
Handling the accelerometer input
Linking the CoreMotion framework
onEnter and onExit
Converting accelerometer input into movements
Calibrating the accelerometer
Implementing the parallax effect in Cocos2d
CCParallaxNode
Particle systems
CCParticleSystem
CCParticleSystem modes
CCParticleSystemModeGravity
CCParticleSystemModeRadius
Common properties
Particle Designer
Extending CCSprite
Shooting some lasers
When UFOs collide
2-star challenge – create explosions
The solution
The attack of the aliens
Drawing and coloring
Drawing the life bar
1-star challenge – collision detection between Dr. Fringe and the UFO
The solution
Summary
3. Your First Online Game
Getting started with our project
Initializing the game
Creating labels with CCLabelBMFont
Littera
CCActions in depth
Drag, drop, and scale
Game Center
Configuring Game Center in iTunes Connect
Configuring the game in Xcode
Checking Game Center's availability
Authenticating the player
Turn-based games
The first turn
Passing the turn
Receiving the turn
Fighting cards
Labels for life points
Match over
Viewing the status when it's not our turn
Summary
4. Beat All Your Enemies Up
Creating an iPad-only game
Image sizes and names
Developing virtual game controls
Moving the zombie
CCSpriteBatchNode
Texture atlases
Creating texture atlases with TexturePacker
Loading texture atlases with Cocos2d
Creating your first animation
3-star challenge – hitting the air
The solution
Creating the zombie class
Creating the human enemies class
Keeping the main character in view
Taking human decisions
Drawing a life bar
Detecting collisions with enemies
2-star challenge – enemies' life bar
Game over
Summary
5. Scenes at the Highest Level
Initializing the game
Developing a tutorial for our game
Storing data using NSUserDefault
Loading data from external files
Transitions
3-star challenge – create a map scene
Summary
6. Physics Behavior
Physics engines
Game physics in Cocos2d
Introducing Chipmunk
CCPhysicsNode
CCPhysicsBody
Creating your first physics
CCPhysicsShape
Creating sprites with physics
Defining shapes
PhysicsEditor
Defining shapes
Loading PhysicsEditor shapes in Xcode
Advanced collision detection with Chipmunk
CCPhysicsBody and CCPhysicsShape properties
CCPhysicsCollisionDelegate
Creating a snooker game with Chipmunk
Setting the snooker table
Configuring the snooker balls
Hitting the cue ball
Managing collisions between snooker bodies
Summary
7. Jump and Run
Initializing the game
Configuring a varied scene
Scrolling the background and blocks
Coding custom physics
Jumping over the platforms
Adding a menu to the game
2-star challenge – adding pinecones to the scene
The solution
1-star challenge – adding a score label
The solution
Summary
8. Defend the Tower
Initializing the game
Developing a pathfinding algorithm
Following the path
Predefining defensive positions
Placing defenses
Giving AI to the defenses
Sharing information between nodes
Loading waves of enemies
2-star challenge – adding explosions
3-star challenge – upgrading defenses
Summary
Index

Cocos2d Game Development Blueprints

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: January 2015
Production reference: 1230115
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78398-788-7
www.packtpub.com
Cover image by Vanesa Domingo ()

Credits

Author
Jorge JordĂĄn
Reviewers
Saeed Afshari
Nader Eloshaiker
Mohsin Mahmood
Commissioning Editor
Ashwin Nair
Acquisition Editor
Richard Brookes-Bland
Content Development Editor
Sumeet Sawant
Technical Editor
Siddhi Rane
Copy Editors
Safis Editing
Ameesha Green
Project Coordinator
Judie Jose
Proofreaders
Ameesha Green
Steve Maguire
Jonathan Todd
Indexer
Mariammal Chettiyar
Graphics
Vanesa Domingo
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat

About the Author

Jorge JordĂĄn is an iOS indie developer who has been passionate about how things work since his childhood. This is the reason why he graduated in Computer Science and became a Java developer. After buying his first iPhone, he became deeply interested in its technology and spent his spare time learning how to develop apps for Apple smartphones.
Over time, he founded Insane Platypus Games (http://insaneplatypusgames.com/) where he tries to make his dreams and games come true. He is also a member of the tutorial team at http://www.raywenderlich.com/.
In his free time, he loves to play video games and bass guitar, and to watch TV series.
You can follow him on Twitter @jjordanarenas.

Table of contents