Game Development Reference
In-Depth Information
As you create more and more CCB files representing individual elements of your game,
they will all become available in the Tileless Editor View. They will become your game's
custom library of prefabricated content nodes, sometimes called prefabs (short for “pre-
fabricated”) or templates.
Adding the Player Sprite
The first prefab will be the player character, and it will be a sprite. Sprites need an image
resource.
Moreover, as much as possible, sprites should be packed into atlas textures to improve
rendering performance. Cocos2d refers to atlas textures as “spritesheets,” but they are the
same thing: a large texture containing multiple images with meta information that tells
Cocos2d where inside the atlas texture to find the image for a given name. Fortunately,
SpriteBuilder automates both Sprite Sheet generation and loading images from a Sprite
Sheet for you.
Tip The more often a particular image is used in the same scene, the more it
will benefit from being in a spritesheet. However, if you add too many or too
large images, the dimensions of the resulting Sprite Sheet may become greater
than the maximum of 4096 x 4096 pixels. If that is the case, SpriteBuilder will
generate a warning message, and to fix it you'd have to remove some images,
preferably by adding them to a new Sprite Sheet.
Creating a Sprite Sheet
You should create a new folder in the File View now, and name it SpriteSheets . Then add
a subfolder to it and name it Global . Then right-click the Global folder to bring up a con-
text menu (see Figure 2-24 ) , and select Make Smart Sprite Sheet .
Search WWH ::




Custom Search