开发者

Moving a background in a timer

How does one move the background image in a timer using cocos2d.

-(void) update:(ccTime)delta

What would be set in this method to move the background only on its y axis? I would like to scroll the m开发者_C百科ap/background downwards as if the player is moving upwards.

I would like to then call this update method somehow every second or so.


-(void)update:(ccTime)delta

{
backgrd.position = ccp(backgrd.position.x,backgrd.position.y-10);
}

In your init:

-(id)init
{
self = [super init];
if(self)
{
//init your backgrd and stuff..
[self schedule:@selector(update:) interval: 1.0];
}
return self;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜