Can any one tell me how to move a CClayer. Li开发者_JS百科ke DoodleJump when object will move upward the background will also move upward.Plz Explain me with some sample code.
This tutorial will teach you how to make a game very similar to doodle jump: Tutorial Part 1
Hope it helps :)
P.S. Check out this guys' channel he has the solution to your background problem.
Use CCFollow
actions.
Make your background sprite height some 1000 px.
[self runAction:[CCFollow actionWithTarget:(u r hero) worldBoundary:CGRectMake(0,0,480,1050)]];
Look at the tile maps code from the cocos2d sample code that is included with cocos2d.
The most basic answer to the question in the title is:
a CCLayer is a CCNode and can be moved by repositioning it:
myLayer.position = ccp(x,y);
use ccaction like ccmoveby or ccmoveto , etc.,
精彩评论