Learning iPhone Game Development with Cocos2D 3.0


Learning iPhone Game Development with Cocos2D 3.0
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
$20.39
save 15%!
Print + free eBook + free PacktLib access to the book: $63.98    Print cover: $39.99
$39.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • Find practical solutions to many real-world game development problems
  • Create games from start to finish by writing code and following detailed step-by-step instructions
  • Full of illustrations and diagrams, practical examples, and tips for deeper understanding of game development in Cocos2D for iPhone

Book Details

Language : English
Paperback : 434 pages [ 235mm x 191mm ]
Release Date : June 2014
ISBN : 1782160140
ISBN 13 : 9781782160144
Author(s) : Kirill Muzykov
Topics and Technologies : All Books, Game Development, Mobile Application Development, Beginner's Guides, Open Source


Table of Contents

Preface
Chapter 1: All About Cocos2D
Chapter 2: Hello Cocos2D
Chapter 3: Cocos2D – Under the Hood
Chapter 4: Rendering Sprites
Chapter 5: Starting the Action
Chapter 6: Rendering Text
Chapter 7: Animations and Particle Systems
Chapter 8: Adding Sound Effects and Music
Chapter 9: User Interface and Navigation
Chapter 10: Physics
Chapter 11: Working with Tile Maps
Pop Quiz Answers
Index
  • Chapter 1: All About Cocos2D
    • Game engines
      • So what is a game engine?
      • So what is this all about?
    • Why Cocos2D?
      • Cocos2D is easy
      • Cocos2D is free
      • Cocos2D is popular
      • Cocos2D is open source
      • Want more?
    • Games created with Cocos2D
      • BADLAND
      • Feed Me Oil 2
      • Lep's World 2
      • Other games
    • Summary
  • Chapter 2: Hello Cocos2D
    • Starting with Xcode
    • Integrating Cocos2D with Xcode
    • Time for action – downloading and installing Cocos2D
    • Creating a Hello World project
    • Time for action – creating a new project from a template
      • Testing your projects on a device and simulator
    • Time for action – running the project on the simulator
    • Modifying the project
    • Time for action – creating a new scene
    • Time for action – displaying the world
    • Time for action – displaying the welcome label
    • Reviewing Cocos2D distribution
    • Time for action – running tests
    • Summary
  • Chapter 3: Cocos2D – Under the Hood
    • Reviewing Cocos2D
      • Have Cocos2D your way
        • Rendering on the screen and the birth of CCNode
        • Organizing the game with CCScene
        • Children of CCNode
        • Back to real Cocos2D
      • Cocos2D game life cycle
        • Reviewing the AppDelegate class
        • Cocos2D configuration options
        • Further life of the game
      • Reviewing the CCDirector class
    • Summary
  • Chapter 4: Rendering Sprites
    • Creating the game project
    • Time for action – creating the Cocohunt Xcode project
    • Time for action – creating GameScene
    • Adding sprites to your game
    • Time for action – adding the background sprite
    • Time for action – adding the player character
    • Time for action – fixing z-order
    • Adding more sprites and moving them
    • Time for action – adding birds
    • Time for action – making the bird move
    • Understanding debug FPS labels
    • Spritesheets and animation
    • Time for action – creating a spritesheet
    • Time for action – modifying the game to use spritesheets
    • Time for action – animating the birds
    • Summary
  • Chapter 5: Starting the Action
    • Making the hunter aim and shoot
    • Time for action – handling touches
    • Time for action – aiming at the touch position
    • Time for action – shooting the arrow
    • Adding more birds to the GameScene class
    • Time for action – adding more birds
    • Time for action – detecting if the arrow hits the bird
    • Winning, losing, and other states
    • Time for action – using states for the bird's life cycle
    • Time for action – animating the shooting and limiting the shooting rate
    • Time for action – winning or losing the game
    • Improving the gameplay
    • Time for action – limiting the aiming range
    • Time for action – alternative control using a gyroscope
    • Summary
  • Chapter 6: Rendering Text
    • The easy way – CCLabelTTF
    • Time for action – adding labels
    • Time for action – updating labels
    • Using bitmap fonts for better performance
      • Choosing a bitmap font generator
    • Time for action – creating a bitmap font using Glyph Designer
      • Using the bitmap font in the game
    • Time for action – adding hit points
    • Time for action – adding the win and lose labels
    • Summary
  • Chapter 7: Animations and Particle Systems
    • Using frame-based animation
    • Time for action – exploding coconut
    • Animating using actions
    • Time for action – hitting the bird animation
    • Skeletal animation
    • Creating particle systems for advanced effects
    • Time for action – adding the feathers explosion
    • Time for action – adding a fire to the scene
    • Time for action – using Particle Designer
    • Summary
  • Chapter 8: Adding Sound Effects and Music
    • Creating AudioManager and playing sound effects
    • Time for action – adding the AudioManager class
    • Time for action – finding and playing our first sound effect
    • Time for action – playing the remaining sound effects
    • Music and background sounds
    • Time for action – adding background sounds
    • Time for action – adding music
    • Enhancing Cocohunt sound effects
    • Time for action – preloading sound effects
    • Time for action – playing a sound at position
    • Summary
  • Chapter 9: User Interface and Navigation
    • Using buttons
    • Time for action – adding menu buttons
    • Time for action – toggling sound and music
    • Time for action – storing settings in NSUserDefaults
    • Navigating between scenes
    • Time for action – pushing AboutScene
    • Time for action – using more transitions
    • Time for action – using the scroll view to select levels
    • Creating modal dialogs and using text input
    • Time for action – pausing the game with a pause dialog
    • Time for action – restarting and exiting the game
    • Time for action – displaying stats when losing and winning
    • Entering and displaying highscores
    • Time for action – displaying highscores with CCTableView
    • Time for action – using the text field
    • Summary
  • Chapter 10: Physics
    • Creating a physics world
    • Time for action – creating a game level with physics
    • Time for action – adding ground to the scene
    • Time for action – adding the hunter
    • Time for action – fixing the hunter movement
    • Detecting and filtering collisions
    • Time for action – detecting and ignoring collisions
    • Time for action – filtering collisions using a collision mask
    • Time for action – filtering collisions using collision groups
    • Applying forces and impulses and using joints
    • Time for action – launching stones
    • Time for action – adding angry birds
    • Summary
  • Chapter 11: Working with Tile Maps
    • Creating tile maps
    • Time for action – creating a tileset
    • Time for action – creating a tile map
    • Time for action – creating the Retina version of the tile map
    • Using the tile maps
    • Time for action – creating TilemapScene
    • Time for action – moving and following the bird
    • Time for action – using parallax scrolling
    • Summary

Kirill Muzykov

Kirill Muzykov has been passionate about programming since the age of six, when he wrote his first line of code in BASIC. After graduating from university, he worked for a couple of years in a software development company, but then decided he wanted to be in charge and founded a new company with two of his colleagues.

It took several years to grow the company from a small team consisting of cofounders to one of the leading companies in the region. However, after almost six years and dozens of completed projects for clients, he tried game development and fell in love with it. A few years ago, he made a big turn in his career and started working as an independent game developer.

In his free time, he loves to play games and watch Simpsons and Futurama. You can find his blog and forum for this book at www.kirillmuzykov.com.

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.


Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


Errata

- 1 submitted: last submission 10 Jul 2014

Errata type | code Page no. 99

The following 6th bullet point:

In the GameScene.m file, add the createBatchNode method as follows:
-(void)addBird
{
       CGSize viewSize = [CCDirector sharedDirector].viewSize;
       _bird = [[Bird alloc]
                  initWithBirdType:BirdTypeSmall];
       _bird.position = ccp(viewSize.width * 0.5f,
                                   viewSize.height * 0.9f);
       [_batchNode addChild:_bird];
}

Should be:

In the GameScene.m file, add the createBatchNode method as follows:

-(void)createBatchNode
{
     //1
     [[CCSpriteFrameCache sharedSpriteFrameCache]
     addSpriteFramesWithFile:@"Cocohunt.plist"];

     //2
     _batchNode = [CCSpriteBatchNode
                         batchNodeWithFile:@"Cocohunt.png"];
     //3
     [self addChild:_batchNode z:1];
}

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Learning iPhone Game Development with Cocos2D 3.0 +    Mastering Object-oriented Python =
50% Off
the second eBook
Price for both: £21.95

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Install Cocos2D and create projects using Cocos2D Xcode templates
  • Understand the Cocos2D architecture and its main classes
  • Render images and text, move and animate them
  • Control your game using touches and a gyroscope
  • Create a user interface and navigate between game screens
  • Use the physics engine to apply forces and detect collisions
  • Add sounds and music and change playback properties
  • Integrate your game with Game Center and make In-App purchases

In Detail

Cocos2D-iPhone (Cocos2D-Swift) is a robust yet simple-touse 2D game framework for iPhone. If you are just starting with game programming, Cocos2D will enable you to make your first game in no time. Even if you are a seasoned game developer, you will still be able to benefit from what Cocos2D offers.

This book will set you on the fast-track to game development with Cocos2D for iPhone. You will start by reviewing the basic classes and hierarchy, dive deep into animations and game flow, and finish by creating a complete game with UI using some advanced techniques.

You will begin the book with an empty Cocos2D project and build on it until you end up with a complete game. The book will teach you how to work on game logic, handling user input, controlling the character, and playing audio. Later, in the final part of the book, we'll have a working game on our hands, and we'll see how we can improve the game further

Approach

This book is an easy-to-follow, step-by-step beginner's guide covering the full process of creating a game. It is packed with examples and illustrations, with comprehensive coverage of each topic.

Who this book is for

If you want to learn how to make games using the Cocos2D framework, this book is for you. If you would like to build a good foundation for a career in game development as an independent game developer or at a game studio, or if you just want to make games as a hobby, then you'll love this book. You should have some basic programming experience with Objective-C and Xcode. To run the code in this book, you will also need an Intel-based Macintosh running OS X Mountain Lion (or later).

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software