Game Development Reference
Think of the CCSpriteBatchNode as similar to a CCLayer , except that it only ac-
cepts CCSprite nodes using the same texture. With that mind-set, I'm sure you'll
find the right places to use the CCSpriteBatchNode .
The Sprites01 Demo Project
This project demonstrates how to use CCSpriteBatchNode . Let's take the first
often start by using just the CCSprite node and then improve the code to support
CCSpriteBatchNode , I found it interesting to show this process exactly and how
the code changes along the way.
The project uses two classes— Ship and Bullet , both derived from CCSprite —to
illustrate how you can change a project from using regular CCSprite objects to a
A Common and Fatal Mistake
Before I begin, I want you to know about a common trap developers new to Objective-
C can quickly find themselves in. It's easy to make this mistake but hard to figure out
do you see what's wrong with this code?
Listing 6-2. A Commonly Made Fatal Mistake When Subclassing CCSprite (or Other
Classes for That Matter)
if ((self = [super initWithFile:@"ship.png"]))