cocos2d-iphonezoomingscalecclayer

How to scale a CCLayer and keep its position?


At the end of the game, I want to zoom out my CCLayer to show all the sprites. When I reduce the scale, the CCLayer become smaller and centered, what I want to know is how to scale the CCLayer and keep its y=0 (Origin at the bottom of the screen). Thanks in advance.

Best regards,


Solution

  • I believe that all CCNode children have an anchorPoint property. CCLayer defaults to (.5,.5) , midScreen. Try setting your layer's anchor point to (0.,0.).