0

Hello I am a beginner to cocos2d and objective c. I am making a cocos2d side scroller. How can I make this code be continuous??

 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));
}
PoKoBros
  • 701
  • 3
  • 9
  • 25

1 Answers1

0

Check out great series of tutorials on Ray Wenderlich site

The part you ask about is covered in the Adding Parallax Scrolling paragraph.

deekay
  • 899
  • 6
  • 8
  • Thanks for the quick reply. I have edited my question at the top. How should I make this continuous? – PoKoBros Aug 17 '13 at 20:30