0
votes

I apologize for my English. Sprite size of 1 x 12 px, after I had to scaleX and try to scroll, I have nothing. Any of your ideas. Thank you! Here's the code:

-(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);
}
1

1 Answers

0
votes

Instead of trying to scroll the textureRect, could you scroll the whole wall layer using wall.position?