Game Development Reference
In-Depth Information
Figure 2-4 . Creating the GameScene.ccb
To be precise, creating a new CCB file lets you choose one of five different types. Here's
a quick rundown of their purpose and major differences:
Scene: A presentable scene. Contrary to what you might expect, its root
node is a CCNode, not a CCScene. It's main difference from the Node type
is that it defaults to display a nice device frame around it in SpriteBuilder.
Node: Essentially, the same as Scene, but it has no device frame, and it has a
root node of class CCNode.
Layer: The only CCB file type whose content size can be set. This makes it
ideal for any fixed-size layer. Again, the root node is of class CCNode.
Sprite: Because sprites are so commonplace in games, this CCB has a CCS-
prite as its root node. Other than that, though, it's the same as the Node type.
Particles: Same as for Sprite type, except here the root node is using the
CCParticleSystem class.
Note Technically, all CCB file types can be used interchangeably. The main
difference between Scene, Node, and Layer is one of terminology and how it's
displayed in SpriteBuilder. The Layer type is the only one that allows for a user-
definable content size. Layer need only be used over Node or Scene whenever
the contents need a fixed, custom sizeā€”for instance, for game levels or fixed-
size overlay menus.
The GameScene.ccb will be presented as an iPhone device frame with no contents (black
screen). Time to fill it with some content.
Search WWH ::




Custom Search