0
私は自分のゲームにタイマーを追加したいと思います。私はGameManagerシングルトンを持っています。Cocos2dゲームタイマー
-(void) startTimerWithDuration:(float) duration
{
[self schedule:@selector(timeUp) interval: duration];
}
-(void) timerUp
{
[self unschedule:_cmd];
[self lose];
}
-(void) lose
{
[[CCDirector sharedDirector] pushScene: [GameOverScene node]];
}
はその後、私のGameSceneの初期化中に、私は
[self addChild:[GameManager node]];
それから私は持っています
[[GameManager sharedManager] startTimerWithDuration:60.0f];
私はコンソールにこのエラーが表示されます。
*** Assertion failure in -[CCTimer initWithTarget:selector:interval:
そして、これがありますcctimer
#if COCOS2D_DEBUG
NSMethodSignature *sig = [t methodSignatureForSelector:s];
NSAssert(sig !=0 , @"Signature not found for selector - does it have the following form? -(void) name: (ccTime) dt");
#endif
理由はわかりません。時間を数えるための共通のアプローチがありますか?それは一般的な使い方なので、私は推測します。
すべきですか? – Andrew
ええ、そこにタイプミス。 – John