Contents

About the Authors

About the Technical Reviewers

Acknowledgments

Preface

images Chapter 1: Introduction

What’s New in the Third Edition?

All About ARC

Why Use cocos2d for iOS?

It’s Free

It’s Open Source

It’s Objective, See?

It’s 2D

It’s Got Physics

It’s Less Technical

It’s Still Programming

It’s Got a Great Community

Why Use Kobold2D over cocos2d-iphone?

Other cocos2d Game Engines

This Book Is for You

Prerequisites

Programming Experience

Objective-C

What You Will Learn

What Beginning iOS Game Developers Will Learn

What iOS App Developers Will Learn

What Cocos2d Developers Will Learn

What’s in This Book

Chapter 2, “Getting Started”

Chapter 3, “Essentials”

Chapter 4, “Your First Game”

Chapter 5, “Game Building Blocks”

Chapter 6, “Sprites In-Depth”

Chapter 7, “Scrolling with Joy”

Chapter 8, “Shoot ’em Up”

Chapter 9, “Particle Effects”

Chapter 10, “Working with Tilemaps”

Chapter 11, “Isometric Tilemaps”

Chapter 12, “Physics Engines”

Chapter 13, “Pinball Game”

Chapter 14, “Game Center”

Chapter 15, “Cocos2d and UIKit Views”

Chapter 16, “Kobold2D Introduction”

Chapter 17, “Conclusion”

Where to Get the Book’s Source Code

Questions and Feedback

images Chapter 2: Getting Started

What You Need to Get Started

System Requirements

Register as an iOS Developer

Certificates and Provisioning Profiles

Download and Install Xcode and the iOS SDK

Download cocos2d or Kobold2D

Install Kobold2D

Create a Kobold2D Project

Install cocos2d and its Xcode Project Templates

How to Create a cocos2d Project

How to Enable ARC in a cocos2d Project

The Anatomy of cocos2d and Kobold2D Applications

The Supporting Files Group

Memory Management with ARC

Changing the World

What Else You Should Know

The iOS Devices

About Memory Usage

The iOS Simulator

About Performance and Logging

Summary

images Chapter 3: Essentials

The cocos2d Scene Graph

The CCNode Class Hierarchy

CCNode

Working with Nodes

Working with Actions

Scheduled Messages

Director, Scenes, and Layers

The Director

CCScene

Scenes and Memory

Pushing and Popping Scenes

CCTransitionScene

CCLayer

CCSprite

Anchor Points Demystified

CCLabelTTF

Menus

Menu Items with Blocks

Actions

Interval Actions

Instant Actions

Orientation, Singletons, Tests, and API References

Orientation Course in Device Orientation

Singletons in cocos2d

Cocos2d Test Cases

Cocos2d API Reference

API References in Xcode and elsewhere

Summary

images Chapter 4: Your First Game

Create the DoodleDrop Project

Start with an ARC-enabled cocos2d Project

Create the DoodleDrop Scene

Adding the Player Sprite

Simple Accelerometer Input

First Test Run

Player Velocity

Adding Obstacles

Collision Detection

Labels and Bitmap Fonts

Adding the Score Label

Introducing CCLabelBMFont

Creating Bitmap Fonts with Glyph Designer

Simply Playing Audio

iPad Considerations

Supporting the Retina iPad

One Universal App or Two Separate Apps?

Restricting Device Support

Summary

images Chapter 5: Game Building Blocks

Working with Multiple Scenes

Adding More Scenes

Loading Next Paragraph, Please Stand By

Working with Multiple Layers

How to Best Implement Levels

CCLayerColor and CCLayerGradient

Subclassing Game Objects from CCSprite

Composing Game Objects Using CCSprite

Curiously Cool CCNode Classes

CCProgressTimer

CCParallaxNode

CCMotionStreak

Summary

images Chapter 6: Sprites In-Depth

Retina Display

CCSpriteBatchNode

When to Use CCSpriteBatchNode

The Sprites01 Demo Project

Sprite Animations the Hard Way

Animation Helper Category

Working with Texture Atlases

What Is a Texture Atlas?

Introducing TexturePacker

Preparing the Project for TexturePacker

Creating a Texture Atlas with TexturePacker

Using the Texture Atlas with cocos2d

Updating the CCAnimation Helper Category

All into One and One for All

Summary

images Chapter 7: Scrolling with Joy

Advanced Parallax Scrolling

Creating the Background as Stripes

Re-creating the Background in Code

Moving the ParallaxBackground

Parallax Speed Factors

Scrolling to Infinity and Beyond

Fixing the Flicker

Repeat, Repeat, Repeat

A Virtual Joypad

Introducing SneakyInput

Touch Button to Shoot

Skinning the Button

Controlling the Action

Digital Controls

Summary

images Chapter 8: Shoot ’em Up

Adding the BulletCache Class

Let’s Make Some Enemies

The Enemy Class

The EnemyCache Class

The Component Classes

Shooting Things

A Healthbar for the Boss

Summary

images Chapter 9: Particle Effects

Example Particle Effects

Creating a Particle Effect the Hard Way

Subclassing CCParticleSystem

CCParticleSystem Properties

Particle Designer

Introducing Particle Designer

Using Particle Designer Effects

Sharing Particle Effects

Shoot ’em Up with Particle Effects

Summary

images Chapter 10: Working with Tilemaps

What Is a Tilemap?

Preparing Images with TexturePacker

Tiled (Qt) Map Editor

Creating a New Tilemap

Designing a Tilemap

Using Orthogonal Tilemaps with Cocos2d

Locating Touched Tiles

Working with the Object Layer

Drawing the Object Layer Rectangles

Scrolling the Tilemap

Summary

images Chapter 11: Isometric Tilemaps

Designing Isometric Tile Graphics

Isometric Tilemap Editing with Tiled

Creating a New Isometric Tilemap

Creating a New Isometric Tileset

Laying Down Some Ground Rules

Isometric Game Programming

Loading the Isometric Tilemap in Cocos2d

Set up Cocos2d for Isometric Tilemaps

Locating an Isometric Tile

Scrolling the Isometric Tilemap

This World Deserves a Better End

Adding a Movable Player Character

Adding More Content to the Game

Summary

images Chapter 12: Physics Engines

Basic Concepts of Physics Engines

Limitations of Physics Engines

The Showdown: Box2D vs. Chipmunk

Box2D

The World According to Box2D

Restricting Movement to the Screen

Converting Points

Adding Boxes to the Box2D World

Updating the Box2D World

Collision Detection

Joint Venture

Chipmunk

Chipmunks in Space

Boxing-In the Boxes

Adding Ticky-Tacky Little Boxes

Updating the Chipmunk Space

A Chipmunk Collision Course

Joints for Chipmunks

Summary

images Chapter 13: Pinball Game

Shapes: Convex and Counterclockwise

Working with PhysicsEditor

Defining the Plunger Shape

Defining the Table Shapes

Defining the Flippers

Defining the Bumper and Ball

Save and Publish

Programming the Pinball Game

Forcing Portrait Orientation

The BodySprite Class

Creating the Pinball Table

Box2D Debug Drawing

Adding the Ball

Forcing the Ball to Move

Adding the Bumpers

The Plunger

The Flippers

Summary

images Chapter 14: Game Center

Enabling Game Center

Creating Your App in iTunes Connect

Setting Up Leaderboards and Achievements

AppController and NavigationController

Configuring the Xcode Project

Game Center Setup Summary

Game Kit Programming

The GameKitHelper Delegate

Checking for Game Center Availability

Authenticating the Local Player

Block Objects

Receiving the Local Player’s Friend List

Leaderboards

Achievements

Matchmaking

Sending and Receiving Data

Summary

images Chapter 15: Cocos2d and UIKit Views

What Is Cocoa Touch?

Using Cocoa Touch and cocos2d Together

Why Mix Cocoa Touch with cocos2d?

Limitations of Mixing Cocoa Touch with cocos2d

How Is Cocoa Touch Different from cocos2d?

Alert: Your First UIKit View in cocos2d

Embedding UIKit Views in a cocos2d App

Adding Views in Front of the cocos2d View

Skinning the UITextField with a UIImage

Adding Views Behind the cocos2d View

Adding Views Designed with Interface Builder

Embedding the cocos2d View in Cocoa Touch Apps

Creating a View-Based Application Project with cocos2d

Designing the User Interface of the Hybrid App

Start Your cocos2d Engine

Changing Scenes

Summary

images Chapter 16: Kobold2D Introduction

Benefits of Using Kobold2D

Kobold2D Is Ready to Use

Kobold2D Is Free

Kobold2D Is Easy to Upgrade

Kobold2D Includes Popular Libraries

Kobold2D Takes Dual-Platform to Heart

The Kobold2D Workspace

The Hello Kobold2D Template Project

The Hello World Project Files

How Kobold2D Launches an App

The Hello Kobold2D Scene and Layer

Running Hello World with iSimulate

DoodleDrop for Mac with KKInput

Summary

images Chapter 17: Out of the Ordinary

Additional Resources for Learning and Working

Where to Find Help

Source Code Projects to Benefit From

Cocos2D Podcast

Tools, Tools, Tools

Cocos2d Reference Apps

The Business of Making Games

Working with Publishers

Finding Freelancers

Finding Free Art and Audio

Finding the Tools of the Trade

Marketing

Engaging Players for More Revenue

Summary

Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.59.50