Reputation: 3766
Can any one tell me how to move a CClayer. Like DoodleJump when object will move upward the background will also move upward.Plz Explain me with some sample code.
Upvotes: 1
Views: 3048
Reputation: 1707
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);
Upvotes: 0
Reputation: 1059
Use CCFollow
actions.
Make your background sprite height some 1000 px.
[self runAction:[CCFollow actionWithTarget:(u r hero) worldBoundary:CGRectMake(0,0,480,1050)]];
Upvotes: 4
Reputation: 1401
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.
Upvotes: 4
Reputation: 4285
Look at the tile maps code from the cocos2d sample code that is included with cocos2d.
Upvotes: 1