你好我是cocos2d和objective c的初学者。我正在制作一个 cocos2d 侧滚动条。如何使此代码连续?
backgroundNode = [CCParallaxNode node];
[self addChild:backgroundNode z:-5];
treeBackground = [CCSprite spriteWithFile:@"thechangedbackgroundcopy.png"];
CGPoint backgroundSpeed = ccp(0.5, 0.5);
[backgroundNode addChild:treeBackground z:-5 parallaxRatio:backgroundSpeed positionOffset:ccp(screenWidth/2, screenHeight/2 - 50)];
[self scheduleUpdate];
-(void)update:(ccTime)delta{
CGPoint backgroundScrollVelocity = ccp(-150, 0);
backgroundNode.position = ccpAdd(backgroundNode.position, ccpMult(backgroundScrollVelocity, delta));
}