You are always welcome here
In this case, you don’t need to set yellow rect as invisible. Just set sprites in-screen & half-in-screen to visible, override ccTouchesMove to move the sprites (not move the layer), and don’t forget to preload the next image.
Take it easy.
But what if is layer only part of screen (for example 50, 100, 250, 300)?
Its some possibility how to crop all objects (CCLabelTTF, CCMenu, CCMenuItemImage, CCSprite…) outside of this layer (something like scissor)?
Exist some cocos object, which is for this purpose or which is possible use for it?
@Milda Genius
It seems there’s no API to do this now. You had to traverse the children in this layer, calculate their distance relation from object~~>getPosition, object~~>getContentSize or sprite~~>getTextureRect, than decide the the CCRect you would pass to each sprite~~>setTextureRect(CCSize);
if your scene is full of screen and you layer is part of the screen, i have no idea about the solution.
but if your game scene is also part of the screen, i can provide some advices: you could change glviewport to adapt your scene, and of course, you should modify glorthf to adapt you viewport too.
I implemented solution by CCSprite::setTextureRect(), its working. I will send my example as inspiration for other users.
But one problem stays. Its restoration of textureRect after my modification to original state. I didnt find any method how to get this information from modifed CCSprite.
I can store original textureRect in userData or store it in my scroll Layer, but dont exist some better solution?