How can I create a count down timer for cocos2d?

后端 未结 6 1602
灰色年华
灰色年华 2020-12-13 15:30

I am developing a 2D iPhone game by using cocos2d. I need a countdown timer. How can I create a count down timer in cocos2d?

6条回答
  •  执笔经年
    2020-12-13 15:53

    -(id) init
    {
        if( ! [super init] )
            return nil;
    
        // schedule timer
        [self schedule: @selector(tick:)];
        [self schedule: @selector(tick2:) interval:0.5];
    
        return self;
    }
    
    -(void) tick: (ccTime) dt
    {
        //some function here
    }
    
    -(void) tick2: (ccTime) dt
    {
        //some function here
    }
    

提交回复
热议问题