iosobjective-cuiscrollviewcocos2d-iphoneccscrolllayer

How to convert this objects from cocoa touch to cocos2d


I've got something like this in my game now:

It's UIView in UIScrollView. This UIView can be width of 480px or 960 etc.

+-----------------+
+   UIScrollView  +
++---------------++                 
++    UIView     ++
++               ++
++ p             ++
++---------------++
+-----------------+

And if i move player p (on screen) he moves to the right. When he is near right side then uiscrollview change offset and moves uiview to the left, and player is on the left side of screen. How can i implement something like this in cocos2d? How can i implement UIScrollView in cocos2d?

thank you for help. I'm new with cocos2d. In clear Cocoa Touch my game is working correctly.


Solution

  • You may need something like CCScrollLayer:

    https://github.com/cocos2d/cocos2d-iphone-extensions/tree/develop/Extensions/CCScrollLayer