About the Authors |
|
xix | |
About the Technical Reviewers |
|
xxi | |
Acknowledgments |
|
xxiii | |
Preface |
|
xxv | |
|
|
1 | (14) |
|
What's New in the Third Edition? |
|
|
2 | (1) |
|
|
2 | (1) |
|
|
3 | (3) |
|
|
3 | (1) |
|
|
4 | (1) |
|
|
4 | (1) |
|
|
4 | (1) |
|
|
5 | (1) |
|
|
5 | (1) |
|
|
5 | (1) |
|
It's Got a Great Community |
|
|
5 | (1) |
|
Why Use Kobold2D over cocos2d-iphone? |
|
|
6 | (1) |
|
Other cocos2d Game Engines |
|
|
7 | (1) |
|
|
8 | (1) |
|
|
8 | (1) |
|
|
8 | (1) |
|
|
8 | (1) |
|
|
9 | (2) |
|
What Beginning iOS Game Developers Will Learn |
|
|
10 | (1) |
|
What iOS App Developers Will Learn |
|
|
10 | (1) |
|
What Cocos2d Developers Will Learn |
|
|
10 | (1) |
|
|
11 | (2) |
|
Chapter 2 "Getting Started" |
|
|
11 | (1) |
|
|
11 | (1) |
|
Chapter 4 "Your First Game" |
|
|
11 | (1) |
|
Chapter 5 "Game Building Blocks" |
|
|
11 | (1) |
|
Chapter 6 "Sprites In-Depth" |
|
|
11 | (1) |
|
Chapter 7 "Scrolling with Joy" |
|
|
12 | (1) |
|
|
12 | (1) |
|
Chapter 9 "Particle Effects" |
|
|
12 | (1) |
|
Chapter 10 "Working with Tilemaps" |
|
|
12 | (1) |
|
Chapter 11 "Isometric Tilemaps" |
|
|
12 | (1) |
|
Chapter 12 "Physics Engines" |
|
|
12 | (1) |
|
Chapter 13 "Pinball Game" |
|
|
12 | (1) |
|
|
12 | (1) |
|
Chapter 15 "Cocos2d and UIKit Views" |
|
|
13 | (1) |
|
Chapter 16 "Kobold2D Introduction" |
|
|
13 | (1) |
|
|
13 | (1) |
|
Where to Get the Book's Source Code |
|
|
13 | (1) |
|
|
13 | (2) |
|
Chapter 2 Getting Started |
|
|
15 | (36) |
|
What You Need to Get Started |
|
|
15 | (19) |
|
|
15 | (1) |
|
Register as an iOS Developer |
|
|
16 | (1) |
|
Certificates and Provisioning Profiles |
|
|
17 | (1) |
|
Download and Install Xcode and the iOS SDK |
|
|
17 | (1) |
|
Download cocos2d or Kobold2D |
|
|
18 | (1) |
|
|
18 | (1) |
|
Create a Kobold2D Project |
|
|
19 | (3) |
|
Install cocos2d and its Xcode Project Templates |
|
|
22 | (1) |
|
How to Create a cocos2d Project |
|
|
23 | (2) |
|
How to Enable ARC in a cocos2d Project |
|
|
25 | (9) |
|
The Anatomy of cocos2d and Kobold2D Applications |
|
|
34 | (7) |
|
The Supporting Files Group |
|
|
36 | (5) |
|
Memory Management with ARC |
|
|
41 | (1) |
|
|
42 | (2) |
|
What Else You Should Know |
|
|
44 | (5) |
|
|
44 | (2) |
|
|
46 | (1) |
|
|
46 | (2) |
|
About Performance and Logging |
|
|
48 | (1) |
|
|
49 | (2) |
|
|
51 | (50) |
|
|
51 | (4) |
|
The CCNode Class Hierarchy |
|
|
55 | (1) |
|
|
56 | (5) |
|
|
56 | (1) |
|
|
57 | (1) |
|
|
57 | (4) |
|
Director, Scenes, and Layers |
|
|
61 | (12) |
|
|
61 | (1) |
|
|
62 | (1) |
|
|
63 | (1) |
|
Pushing and Popping Scenes |
|
|
64 | (1) |
|
|
65 | (3) |
|
|
68 | (5) |
|
|
73 | (2) |
|
Anchor Points Demystified |
|
|
74 | (1) |
|
|
75 | (1) |
|
|
76 | (5) |
|
|
78 | (3) |
|
|
81 | (12) |
|
|
82 | (7) |
|
|
89 | (4) |
|
Orientation, Singletons, Tests, and API References |
|
|
93 | (6) |
|
Orientation Course in Device Orientation |
|
|
93 | (2) |
|
|
95 | (3) |
|
|
98 | (1) |
|
|
98 | (1) |
|
API References in Xcode and elsewhere |
|
|
99 | (1) |
|
|
99 | (2) |
|
Chapter 4 Your First Game |
|
|
101 | (32) |
|
Create the DoodleDrop Project |
|
|
102 | (1) |
|
Start with an ARC-enabled cocos2d Project |
|
|
102 | (2) |
|
Create the DoodleDrop Scene |
|
|
104 | (4) |
|
|
108 | (4) |
|
Simple Accelerometer Input |
|
|
112 | (1) |
|
|
113 | (1) |
|
|
113 | (3) |
|
|
116 | (6) |
|
|
122 | (1) |
|
|
123 | (5) |
|
|
124 | (1) |
|
Introducing CCLabelBMFont |
|
|
125 | (1) |
|
Creating Bitmap Fonts with Glyph Designer |
|
|
126 | (2) |
|
|
128 | (1) |
|
|
129 | (3) |
|
Supporting the Retina iPad |
|
|
129 | (1) |
|
One Universal App or Two Separate Apps? |
|
|
130 | (1) |
|
Restricting Device Support |
|
|
131 | (1) |
|
|
132 | (1) |
|
Chapter 5 Game Building Blocks |
|
|
133 | (26) |
|
Working with Multiple Scenes |
|
|
133 | (6) |
|
|
133 | (3) |
|
Loading Next Paragraph, Please Stand By |
|
|
136 | (3) |
|
Working with Multiple Layers |
|
|
139 | (8) |
|
How to Best Implement Levels |
|
|
145 | (1) |
|
CCLayerColor and CCLayerGradient |
|
|
146 | (1) |
|
Subclassing Game Objects from CCSprite |
|
|
147 | (1) |
|
Composing Game Objects Using CCSprite |
|
|
148 | (4) |
|
Curiously Cool CCNode Classes |
|
|
152 | (6) |
|
|
153 | (1) |
|
|
154 | (2) |
|
|
156 | (2) |
|
|
158 | (1) |
|
Chapter 6 Sprites In-Depth |
|
|
159 | (28) |
|
|
160 | (3) |
|
|
163 | (7) |
|
When to Use CCSpriteBatchNode |
|
|
164 | (1) |
|
The Sprites01 Demo Project |
|
|
164 | (6) |
|
Sprite Animations the Hard Way |
|
|
170 | (2) |
|
Animation Helper Category |
|
|
172 | (2) |
|
Working with Texture Atlases |
|
|
174 | (11) |
|
|
175 | (1) |
|
Introducing TexturePacker |
|
|
175 | (1) |
|
Preparing the Project for TexturePacker |
|
|
176 | (1) |
|
Creating a Texture Atlas with TexturePacker |
|
|
177 | (4) |
|
Using the Texture Atlas with cocos2d |
|
|
181 | (2) |
|
Updating the CCAnimation Helper Category |
|
|
183 | (1) |
|
All into One and One for All |
|
|
184 | (1) |
|
|
185 | (2) |
|
Chapter 7 Scrolling with Joy |
|
|
187 | (26) |
|
Advanced Parallax Scrolling |
|
|
187 | (14) |
|
Creating the Background as Stripes |
|
|
187 | (3) |
|
Re-creating the Background in Code |
|
|
190 | (2) |
|
Moving the ParallaxBackground |
|
|
192 | (2) |
|
|
194 | (2) |
|
Scrolling to Infinity and Beyond |
|
|
196 | (3) |
|
|
199 | (1) |
|
|
200 | (1) |
|
|
201 | (11) |
|
|
202 | (2) |
|
|
204 | (2) |
|
|
206 | (3) |
|
|
209 | (3) |
|
|
212 | (1) |
|
|
212 | (1) |
|
|
213 | (26) |
|
Adding the BulletCache Class |
|
|
213 | (6) |
|
|
219 | (10) |
|
|
221 | (5) |
|
|
226 | (3) |
|
|
229 | (3) |
|
|
232 | (3) |
|
|
235 | (3) |
|
|
238 | (1) |
|
Chapter 9 Particle Effects |
|
|
239 | (26) |
|
|
239 | (4) |
|
Creating a Particle Effect the Hard Way |
|
|
243 | (12) |
|
Subclassing CCParticleSystem |
|
|
244 | (2) |
|
CCParticleSystem Properties |
|
|
246 | (9) |
|
|
255 | (6) |
|
Introducing Particle Designer |
|
|
256 | (2) |
|
Using Particle Designer Effects |
|
|
258 | (1) |
|
|
259 | (2) |
|
Shoot 'em Up with Particle Effects |
|
|
261 | (3) |
|
|
264 | (1) |
|
Chapter 10 Working with Tilemaps |
|
|
265 | (26) |
|
|
265 | (4) |
|
Preparing Images with TexturePacker |
|
|
269 | (1) |
|
|
270 | (7) |
|
|
270 | (3) |
|
|
273 | (4) |
|
Using Orthogonal Tilemaps with Cocos2d |
|
|
277 | (13) |
|
|
281 | (3) |
|
Working with the Object Layer |
|
|
284 | (2) |
|
Drawing the Object Layer Rectangles |
|
|
286 | (2) |
|
|
288 | (2) |
|
|
290 | (1) |
|
Chapter 11 Isometric Tilemaps |
|
|
291 | (30) |
|
Designing Isometric Tile Graphics |
|
|
292 | (3) |
|
Isometric Tilemap Editing with Tiled |
|
|
295 | (5) |
|
Creating a New Isometric Tilemap |
|
|
295 | (2) |
|
Creating a New Isometric Tileset |
|
|
297 | (1) |
|
Laying Down Some Ground Rules |
|
|
298 | (2) |
|
Isometric Game Programming |
|
|
300 | (19) |
|
Loading the Isometric Tilemap in Cocos2d |
|
|
300 | (1) |
|
Set up Cocos2d for Isometric Tilemaps |
|
|
300 | (2) |
|
Locating an Isometric Tile |
|
|
302 | (3) |
|
Scrolling the Isometric Tilemap |
|
|
305 | (1) |
|
This World Deserves a Better End |
|
|
306 | (4) |
|
Adding a Movable Player Character |
|
|
310 | (9) |
|
Adding More Content to the Game |
|
|
319 | (1) |
|
|
319 | (2) |
|
Chapter 12 Physics Engines |
|
|
321 | (26) |
|
Basic Concepts of Physics Engines |
|
|
321 | (1) |
|
Limitations of Physics Engines |
|
|
322 | (1) |
|
The Showdown: Box2D vs. Chipmunk |
|
|
322 | (1) |
|
|
323 | (14) |
|
The World According to Box2D |
|
|
325 | (3) |
|
Restricting Movement to the Screen |
|
|
328 | (2) |
|
|
330 | (1) |
|
Adding Boxes to the Box2D World |
|
|
330 | (2) |
|
|
332 | (1) |
|
|
333 | (2) |
|
|
335 | (2) |
|
|
337 | (8) |
|
|
337 | (2) |
|
|
339 | (1) |
|
Adding Ticky-Tacky Little Boxes |
|
|
340 | (1) |
|
Updating the Chipmunk Space |
|
|
341 | (1) |
|
A Chipmunk Collision Course |
|
|
342 | (1) |
|
|
343 | (2) |
|
|
345 | (2) |
|
|
347 | (44) |
|
Shapes: Convex and Counterclockwise |
|
|
348 | (1) |
|
Working with PhysicsEditor |
|
|
349 | (9) |
|
Defining the Plunger Shape |
|
|
351 | (2) |
|
Defining the Table Shapes |
|
|
353 | (3) |
|
|
356 | (2) |
|
Defining the Bumper and Ball |
|
|
358 | (1) |
|
|
358 | (1) |
|
Programming the Pinball Game |
|
|
358 | (32) |
|
Forcing Portrait Orientation |
|
|
359 | (1) |
|
|
359 | (4) |
|
Creating the Pinball Table |
|
|
363 | (5) |
|
|
368 | (1) |
|
|
369 | (3) |
|
|
372 | (4) |
|
|
376 | (1) |
|
|
377 | (9) |
|
|
386 | (4) |
|
|
390 | (1) |
|
|
391 | (38) |
|
|
391 | (6) |
|
Creating Your App in Runes Connect |
|
|
392 | (1) |
|
Setting Up Leaderboards and Achievements |
|
|
393 | (1) |
|
AppController and NavigationController |
|
|
393 | (1) |
|
Configuring the Xcode Project |
|
|
394 | (3) |
|
Game Center Setup Summary |
|
|
397 | (1) |
|
|
397 | (30) |
|
The GameKitHelper Delegate |
|
|
398 | (1) |
|
Checking for Game Center Availability |
|
|
399 | (1) |
|
Authenticating the Local Player |
|
|
400 | (3) |
|
|
403 | (2) |
|
Receiving the Local Player's Friend List |
|
|
405 | (3) |
|
|
408 | (5) |
|
|
413 | (5) |
|
|
418 | (5) |
|
Sending and Receiving Data |
|
|
423 | (4) |
|
|
427 | (2) |
|
Chapter 15 Cocos2d and UIKit Views |
|
|
429 | (30) |
|
|
429 | (1) |
|
Using Cocoa Touch and cocos2d Together |
|
|
430 | (3) |
|
Why Mix Cocoa Touch with cocos2d? |
|
|
430 | (1) |
|
Limitations of Mixing Cocoa Touch with cocos2d |
|
|
431 | (1) |
|
How Is Cocoa Touch Different from cocos2d? |
|
|
431 | (2) |
|
Alert: Your First UIKit View in cocos2d |
|
|
433 | (2) |
|
Embedding UIKit Views in a cocos2d App |
|
|
435 | (13) |
|
Adding Views in Front of the cocos2d View |
|
|
435 | (3) |
|
Skinning the UITextField with a UIImage |
|
|
438 | (1) |
|
Adding Views Behind the cocos2d View |
|
|
439 | (6) |
|
Adding Views Designed with Interface Builder |
|
|
445 | (3) |
|
Embedding the cocos2d View in Cocoa Touch Apps |
|
|
448 | (9) |
|
Creating a View-Based Application Project with cocos2d |
|
|
448 | (2) |
|
Designing the User Interface of the Hybrid App |
|
|
450 | (2) |
|
Start Your cocos2d Engine |
|
|
452 | (3) |
|
|
455 | (2) |
|
|
457 | (2) |
|
Chapter 16 Kobold2D Introduction |
|
|
459 | (20) |
|
Benefits of Using Kobold2D |
|
|
459 | (3) |
|
|
460 | (1) |
|
|
460 | (1) |
|
Kobold2D Is Easy to Upgrade |
|
|
460 | (1) |
|
Kobold2D Includes Popular Libraries |
|
|
461 | (1) |
|
Kobold2D Takes Dual-Platform to Heart |
|
|
462 | (1) |
|
|
462 | (2) |
|
The Hello Kobold2D Template Project |
|
|
464 | (10) |
|
The Hello World Project Files |
|
|
464 | (2) |
|
How Kobold2D Launches an App |
|
|
466 | (3) |
|
The Hello Kobold2D Scene and Layer |
|
|
469 | (4) |
|
Running Hello World with iSimulate |
|
|
473 | (1) |
|
DoodleDrop for Mac with KKInput |
|
|
474 | (3) |
|
|
477 | (2) |
|
Chapter 17 Out of the Ordinary |
|
|
479 | (26) |
|
Additional Resources for Learning and Working |
|
|
480 | (12) |
|
|
480 | (2) |
|
Source Code Projects to Benefit From |
|
|
482 | (5) |
|
|
487 | (1) |
|
|
488 | (1) |
|
|
489 | (3) |
|
The Business of Making Games |
|
|
492 | (10) |
|
|
492 | (1) |
|
|
493 | (1) |
|
Finding Free Art and Audio |
|
|
494 | (1) |
|
Finding the Tools of the Trade |
|
|
494 | (1) |
|
|
495 | (3) |
|
Engaging Players for More Revenue |
|
|
498 | (4) |
|
|
502 | (3) |
Index |
|
505 | |