Game Development Reference
In-Depth Information
I'm also a very cautious programmer and decided to add the logging statements intro-
duced in Chapter 3 . The resulting GameLayer.h is shown in Listing 4-1 , and
GameLayer.m is in Listing 4-2 .
Listing 4-1 .
GameLayer.h with the Scene Method
#import < Foundation/Foundation.h>
#import "cocos2d.h"
@interface GameLayer : CCLayer
{
}
+(id) scene;
@end
Listing 4-2 . GameLayer.m with the Scene Method and Standard Methods Added, In-
cluding Logging
#import "GameLayer.h"
@implementation GameLayer
+(id) scene
{
CCScene *scene = [CCScene node];
CCLayer* layer = [GameLayer node];
[scene addChild:layer];
return scene;
}
-(id) init
{
if ((self = [super init]))
{
CCLOG(@"%@: %@", NSStringFromSelector(_cmd), self);
}
 
 
 
 
Search Nedrilad ::




Custom Search