Below the code have ability to endless background rotation from upward to downward direction OR something else way.
I just want opposite from this rotation. I tried but could solve this problem.
Anybody suggest me , how to do this ?
private void animateBackground() {
_oddBackground = CCSprite.sprite("sky.png");
_evenBackground = CCSprite.sprite("sky.png");
/*from Upward to Downward direction background rotation */
_oddBackground.setPosition(winSize.width / 2, winSize.height / 2);
_evenBackground.setPosition(winSize.width / 2, winSize.height + (winSize.height / 2));
schedule("scroll");
addChild(_oddBackground).addChild(_evenBackground);
}
public void scroll(float dt) {
// move them 100*dt pixels down
_oddBackground.setPosition(_oddBackground.getPosition().x, _oddBackground.getPosition().y - 100 * dt);
_evenBackground.setPosition(_evenBackground.getPosition().x, _evenBackground.getPosition().y - 100 * dt);
// reset position when they are off from view.
if (_oddBackground.getPosition().y < - winSize.height / 2) {
_oddBackground.setPosition(winSize.width / 2, winSize.height / 2);
_evenBackground.setPosition(winSize.width / 2, winSize.height+ (winSize.height / 2));
}
}