2012-04-18 216 views
0

我爲我的英語道歉。 Sprite大小爲1 x 12像素,在我必須縮放並嘗試滾動之後,我什麼也沒有。你的任何想法。謝謝! 下面的代碼:Cocos2d滾動比例精靈

-(void) proba 
{ 
    CGPoint pos = ccp(50,100); 
    int dlin = 200; 
    wall = [CCSprite spriteWithFile:@"wall.png"]; //wall.png 1x12px 
    wall.scaleX = dlin; 
    wall.anchorPoint = ccp(0, 0.5); 
    wall.position = pos; 

    [self addChild:wall]; 

    [self schedule:@selector(wall_scroll)]; 
} 
-(void) wall_scroll 
{ 
    static float offset = 0.1f; 
    wall.textureRect = CGRectMake(wall.textureRect.origin.x - offset , 
            wall.textureRect.origin.y , 
            wall.scaleX, 
            wall.textureRect.size.height); 
} 

回答

0

而不是試圖滾動textureRect,你可以使用滾動的wall.position整個牆面層?

+0

我需要在狹窄的空間內爬行。 – user1340134 2012-04-19 04:17:22