CCScrollerScene for Cocos2d Games
This class can easily make a scrolling background for any iphone game. Simply set the sprite image and the speeds, then call start scroller (DONE)
Usage:
ScrollingScene *scroller = [ScrollingScene scene];//set background image name, screen pos and scale[scroller initBackgroundWithSpriteName:@"background.png" position:ccp(0, 0) usingScale:1];//[scroller setIsVertical:YES]; //option for vertical scrolling[self addChild:scroller]; //start the scrolling [scroller startScroller]; // [scroller scrollIncrement:ccp(0,100)]; //optional for incremental scrolling//To stop scroller call[self unscheduleAllSelectors];
Optional:
//change the speed of the interval
[scroller setIntervalSpeed:0.002];
[scroller setScrollSpeed:2];
//stop scrolling
[scroller stopScroller]