我为我的英语道歉。精灵大小为1 x 12 px,在我不得不缩放X并尝试滚动之后,我什么都没有。你的任何想法。谢谢! 这是代码:
-(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 :(得分:0)
您可以使用wall.position吗?
滚动整个墙层,而不是尝试滚动textureRect