2014-03-19 71 views
0

我遇到过我的CCScene问题。我试图在场上设置我的场景的位置。这是我为我的场景初始化:设置摄像头位置CCScene

- (id)init 
{ 

    // Apple recommend assigning self with supers return value 
    self = [super init]; 
    if (!self) return(nil); 

    self.userInteractionEnabled = YES;  

    // Create a colored background (Dark Grey) 
    CCNodeColor *background = [CCNodeColor nodeWithColor:[CCColor colorWithRed:0 green:0 blue:0 alpha:1.0f]]; 
    [self addChild:background]; 

    // Add a sprite 
    _player = [[PlayerBlock alloc]initWithX:[bp getPlayerX] withY:[bp getPlayerY] maxX:1000 maxY:1000 levelBlocks:blocks endBlock:fb]; 

    [self addChild:_player]; 

    self.positionType=CCPositionTypePoints; 
    self.position=_player.position; 
    // done 
    return self; 
} 

这是我对选手框初始化:

-(id)initWithX:(double)x withY:(double)y maxX:(double)maxX maxY:(double)maxY levelBlocks:(NSMutableArray*)sprites endBlock:(FinishBlock*)finishBlock{ 
    self=[self initWithImageNamed:@"player.png"]; 
    self.position = ccp(x,y); 
    _finish=finishBlock; 
    _sprites=sprites; 
    _startX=x; 
    _startY=y; 
    _maxX=maxX; 
    _moving=0; 
    _maxY=maxY; 
    self.width=25; 
    self.height=25; 
    self.positionType=CCPositionTypePoints; 
    return self; 
} 

目前发生的是,它不注重选手框上。

任何人都可以为我清除它吗?

回答

0

所需此行添加到我的场景:

self.contentSize=CGSizeMake(1000, 1000); 

正如我的精灵躺在现场的边界外。