您好我是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));
}