Before we move on to our hero, let's turn our attention to the other endless element of the game: the background. We want to have a two-layer parallax background that is endlessly scrolling. A parallax background is simply one that has multiple layers that scroll at different rates, to simulate the way that distant terrain looks like it is moving slower than closer terrain. We simulate this by throttling the scrolling speed of each layer of the background to a relative speed. Let's look at our background class and see how it works.
-(id) init { if(self = [super init]) { size = [[CCDirector sharedDirector] winSize]; bg1 = [CCSprite spriteWithFile:@"bg_mtns.png"]; [bg1 setAnchorPoint:ccp(0,0)]; [bg1 setPosition:ccp(0, 0)]; [self addChild:bg1]; bg2 = [CCSprite spriteWithFile:@"bg_mtns.png"]; [bg2 setAnchorPoint:ccp(0,0)]; [bg2 setPosition:ccp(1001, 0)]; [self...