Game Development Reference
In-Depth Information
#import "cocos2d.h"
#import "Box2D.h"
@interface TableSetup : CCSpriteBatchNode
{
}
+(id) setupTableWithWorld:(b2World*)world;
@end
And because that's so unspectacular, let's turn our attention to the implementation of
the TableSetup class of the project, shown in Listing 13-5 .
Listing 13-5 . TableSetup Class Implementation
#import "TableSetup.h"
#import "Constants.h"
#import "TablePart.h"
@implementation TableSetup
-(id) initTableWithWorld:(b2World*)world
{
if ((self = [super initWithFile:@"pinball.pvr.ccz" capacity:5]))
{
// add the table blocks
[self addChild:[TablePart tablePartInWorld:world
position:ccp(0, 480)
name:@"table-top"]];
[self addChild:[TablePart tablePartInWorld:world
position:ccp(0, 0)
name:@"table-bottom"]];
[self addChild:[TablePart tablePartInWorld:world
position:ccp(0, 263)
name:@"table-left"]];
}
return self;
}
 
 
Search Nedrilad ::




Custom Search