1
votes

I have a sprite which moves across the screen.so i want to switch between the scenes.how can i do that.i am not interested in using Tile Map.I want just like angry birds scene scrolling.

Any Idea,

Thanks

2

2 Answers

1
votes

If i understand what your asking you could just add everything to a cclayer and have everything as a child of it and move the full layer left or right to scroll

0
votes

As glogic says, create a CCLayer and then add a CCSprite to it with an image much larger than the screen size.

Now in your touch handling code, do something like this...

OnTouchBegin - store position of the touch

OnTouchMoved - calculate distance from stored position where touch started and move the whole layer by that much.

OnTouchEnd - If your sprite has move too far and you have gone off the edge of the sprite, slide it back to the edge