存档

2010年8月 的存档

Doodle Jump like gameplay

2010年8月17日 没有评论

I am pretty new to cocos2d. Could someone please direct me to a good tutorial on how to make a game like doodle jump. I need to know how to make him bounce of the platforms, spawn platforms, use the accelerometer to control the player, etc.

Thanks

Check TweeJump: http://github.com/haqu/tweejump

It has the doodle jump basic functionality. You’ll have to update it to the latest cocos2d version, but it is a great starting point.

The primary developer of Cocos2d offers the source to a complete sample game for purchase here: Sapus Tongue Source.

分类: stackoverflow精选, unity3d 标签:

cocos2d: How to set a timer

2010年8月1日 没有评论

I am developing an iPhone app using cocos2d and box2d.In this app i require to set a timer.
The timer will show the remaining time in hand of an player to reach destination…

how can i do that…..i have drawn a scene but no sure as i am beginner how to add timer..

thanks

You could use CCTimer.
Just like this:

float delay = 1.0; // Number of seconds between each call of myTimedMethod:
CCTimer *myTimer = [[CCTimer alloc] initWithTarget:self 
                             selector:@selector(myTimedMethod:) interval:delay]];

The method myTimedMethod: will get called then each second.

I would simply schedule a selector with an interval. This works in all CCNode based classes.

Schedule a selector triggered once per second:

[self schedule:@selector(timerUpdate:) interval:1];

This method gets called once per second:

-(void) timerUpdate:(ccTime)delta
{
  numSeconds++;
  // update timer here, using numSeconds
}

Parceval’s method using CCTimer is ok too but you should prefer the static autorelease initializer like this:

CCTimer *myTimer = [CCTimer timerWithTarget:self
                                   selector:@selector(myTimedMethod:)
                                   interval:delay]];
分类: stackoverflow精选, unity3d 标签: