In my cocos2d app I was wondering how to make a CCSprite move on the screen but have the screen focused on the CCSprite, so when the sprite moves the view moves with the CCSprite. Is there a tutorial to do this?
Thanks
|
In my cocos2d app I was wondering how to make a CCSprite move on the screen but have the screen focused on the CCSprite, so when the sprite moves the view moves with the CCSprite. Is there a tutorial to do this? Thanks |
|||
|
|
|
If, for some reason, you wanted to manually make a camera system, the way to do it would be to set a camera x and y based on the position of the sprite you're trying to follow, and then draw everything at its normal position minus the camera x and y values. |
|||
|
|
|
There's a
For more information, have a look at the API docs. |
|||
|
|
|
For making such games you need to create some layers and then move the layers. Just like in a 2D side scrolling game the background layer moves(or changes) and only the y coordinate of the character is changed so that the character appears to be moving. For such game you can refer to this post --- http://johnehartzog.com/2009/10/2d-scrolling-game-with-cocos2d-tilemap-with-zoom/ and to find additional codes for the same you can check out the code snippet and the end of this page. |
|||
|
|