PacktLib: Cocos2d for iPhone 0.99 Beginner's Guide

Cocos2d for iPhone 0.99 Beginner's Guide

Credits

About the Author

About the Reviewers

Preface

Getting Started with Cocos2d

Downloading Cocos2d for iPhone

Time for action - opening the samples project

Installing the templates

Time for action - installing the templates

Creating a new project from the templates

Time for action - creating a HelloCocos2d project

Managing the game with the CCDirector

Time for action - taking a first look at the HelloCocos2dAppDelegate

Doing everything with CCNodes

Time for action - peeking at the HelloWorldScene class

Checking your timing

Time for action - using timers to make units shoot each second

Time for action - destroying your units

Debugging cocos2d applications

Time for action - checking Cocos2d debug messages

Time for action - checking deallocing messages

Time for action - knowing your errors

Time for action - removing debug messages

Summary

Playing with Sprites

Making a puzzle game

Beginning a new project

Time for action - creating a new project

Let's Do Some Actions

Basic actions

Time for action - animating the stone falling

Time for action - destroying stones with actions

Time for action - tinting the time bar

Composition actions

Time for action - making a nice disappear effect

Time for action - making stones fall and grow

Time for action - animating the grid

Ease actions

Time for action - modifying animations with ease actions

Effect actions

Time for action - making the background shake when matching five stones

Special actions

Time for action - ready, set, go!

Time for action - telling the player he lost

Animations

Time for action - animating the stones

Summary

Pasting Labels

Using CCLabels

Time for action - first time tutorials

Displaying texts with CCLabelAtlas

Time for action - displaying and updating scores with CCLabelAtlas

Creating texts with CCBitmapFontAtlas

Time for action - showing feedback

Time for action - running actions on texts

Making your own BitmapFontAtlas with BM Font tool

Time for action - creating your own Bitmap font

Wrapping up the game

Summary

Surfing through Scenes

Aerial Gun, a vertical shooter game

Creating new scenes

Time for action - creating the splash and main menu scene

Transitioning through scenes

Time for action - moving through scenes in a nice way

Implementing the game logic

Time for action - creating the hero class

Time for action - throwing enemies at your hero

Time for action - creating and reusing bullets

Handling accelerometer input

Time for action - moving your hero with the accelerometer

Handling touches on layers

Time for action - firing the bullets

Detecting collisions

Time for action - shooting down your enemies

Time for action - losing your life

Adding more layers to scenes

Time for action - creating a HUD to display lives and the score

Time for action - creating a pause menu

Time for action - pausing the game while inactive

Summary

Menu Design

Creating a simple menu

Time for action - adding a menu with texts to the main scene

Using image menu items

Time for action - adding a difficulty selection screen

Animating menu items

Time for action - animating the main menu

Using toggle menu items

Time for action - creating the options menu

Saving and loading preferences

Time for action - persisting options data

Summary

Implementing Particle Systems

Taking a look at the prebuilt particle systems

Time for action - running the particle test

Time for action - analyzing the ParticleMeteor system

Implementing particle systems in your game using Gravity mode

Time for action - making bombs explode

Using the radius mode

Time for action - hurting your enemies

Using Particle Designer to create particle systems

Time for action - creating a smoke trail

Summary

Familiarizing Yourself with Tilemaps

Using tilemaps

Creating tilemaps with Tiled

Time for action - creating your first map

Loading tilemaps in Cocos2d

Time for action - using tilemaps in Cocos2d

Time for action - running actions on layers

Time for action - reaching the end of the level

Time for action - fixing black gaps and glitches

Using layers to hold objects

Time for action - adding object layers in tiled

Time for action - retrieving objects in Cocos2d

Summary

Playing Sounds with CocosDenshion

What is CocosDenshion?

Getting started with sounds

Time for action - using SimpleAudioEngine

Time for action - playing background music with SimpleAudioEngine

Using CDSoundEngine

Time for action - setting it up

Time for action - playing sound effects for explosions

Time for action - loading effects asynchronously with CDSoundEngine

Time for action - playing background music with CDAudioManager

Summary

Using Physics Engines

A word about physics engines

Totem balance, a physical game

Time for action - taking a look at the Chipmunk template

Preparing the game

Bringing objects to life

Time for action - creating a poly-shaped object

Time for action - creating the goal platform

Time for action - building blocks

Time for action - destroying shapes with touch

Collision callbacks

Time for action - losing the game

Time for action - winning the game

Placing static shapes

Summary

Integrating OpenFeint

Signing up and downloading the SDK

Time for action - signing up and downloading the SDK

Integrating OpenFeint into your game

Time for action - making OpenFeint work

Time for action - displaying the OpenFeint dashboard

Adding leaderboards to your game

Time for action - creating a leaderboard

Adding achievements to your game

Time for action - creating an achievement

Submitting your game for OpenFeint approval

Summary

Pop Quiz - Answers

Pop Quiz - Answers

Pop Quiz - Answers

Pop Quiz - Answers

Pop Quiz - Answers

Pop Quiz - Answers

Pop Quiz - Answers

Pop Quiz - Answers

Pop Quiz - Answers

Pop Quiz - Answers

Pop Quiz - Answers