Game Development Reference
In-Depth Information
ded it to the IsoTilemap02 project. The player is a class derived from CCSprite ,
aptly named Player . Listing 11-4 shows the header file.
Listing 11-4. The Player Class Interface
#import < Foundation/Foundation.h>
#import "cocos2d.h"
@interface Player : CCSprite
+(id) player;
The +(id) player method in Listing 11-5 allocates and initializes the sprite with
the ninja.png file.
Listing 11-5. The Player Class Implementation
#import "Player.h"
@implementation Player
+(id) player
return [[self alloc] initWithFile:@"ninja.png"];
You then create the player in the TileMapLayer class's init method:
#import "Player.h"
-(id) init
self = [super init];
if (self)
Search Nedrilad ::

Custom Search