私はcocos2dでカウントダウンタイマーを作成しようとしていますが、この問題を解決することはできません。私のコードはこれよりも下です。おそらくロジックが間違っていますが修正できません。cocos2dのカウントダウンタイマー?
-(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if((self=[super init])) {
CCSprite *background = [CCSprite spriteWithFile:@"backgame.png"];
CGSize size = [[CCDirector sharedDirector] winSize];
[background setPosition:ccp(size.width/2, size.height/2)];
[self addChild: background];
[self schedule:@selector(countDown:)];
}
return self;
}
-(void)countDown:(ccTime)delta
{
CCLabel *text = [CCLabel labelWithString:@" "
fontName:@"BallsoOnTheRampage" fontSize:46];
text.position = ccp(160,455);
text.color = ccYELLOW;
[self addChild:text];
int countTime = 20;
while (countTime != 0) {
countTime -= 1;
[text setString:[NSString stringWithFormat:@"%i", countTime]];
}
}
ゼブロンは返信のおかげで、スティーブンはそのコードとその日の今日の勝利は、あなたが多くのおかげで助けを期待する方法を働いて、私は今多くを学んだ。 – gangmobile
@gangmobile、受け入れられたとして私の答えをチェックすることができます忘れないでください。 :D –