How can I create a count down timer for cocos2d?

后端 未结 6 1624
灰色年华
灰色年华 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:49

    http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:best_practices

    • Try NOT to use Cocoa’s NSTimer. Instead use cocos2d’s own scheduler.
    • If you use cocos2d scheduler, you will have:
      • automatic pause/resume.
      • when the Layer (Scene, Sprite, CocosNode) enters the stage the timer will be automatically activated, and when it leaves the stage it will be automatically deactivated.
      • Your target/selector will be called with a delta time...

提交回复
热议问题