2014-03-19 96 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); 

正如我的精靈躺在現場的邊界外。