Game Development Reference
In-Depth Information
cause even in CCB files of type Scene, the root node is a CCNode instance. Click Next
and save the file.
Figure 2-11 . Creating a new Objective-C class named GameScene
Tip If you ever create a custom class for CCB files of type Sprite, you'll have
to make the class a subclass of CCSprite . Accordingly, for Particles CCBs,
you'll have to make them a subclass of CCParticleSystem . For all other
CCB file types, you have to make the custom class a subclass of CCNode .
Now select the GameScene.m file. As a quick test of whether the class is created and ini-
tialized, you can implement the didLoadFromCCB method sent by CCBReader to
every node it creates. Your GameScene.m implementation should look like this:
#import "GameScene.h"
@implementation GameScene
-(void) didLoadFromCCB
{
NSLog(@"GameScene created");
}
@end
When you build and run the app now, you'll find the following log message in the Xcode
Debug Console, located at the bottom of the Xcode window in the debug area. See Figure
2-3 , the Debug Console is the right half of the area labelled with 4. If you can't see the
Search WWH ::




Custom Search