【发布时间】:2013-05-06 09:19:48
【问题描述】:
我使用了http://www.raywenderlich.com/25736/how-to-make-a-simple-iphone-game-with-cocos2d-2-x-tutorial的cocos2d游戏教程,将分数添加到scorelabel后,分数增加了,但之前的分数没有被删除,新的分数被添加到之前分数的标签上方
代码:
CGSize winSize = [[CCDirector sharedDirector] winSize];
CCLabelTTF * label1 = [CCLabelTTF labelWithString:@"_monsterdestroyed" fontName:@"Arial" fontSize:32];
score=score + 2;
[label1 setString:[NSString stringWithFormat:@"%d",score]];
label1.color = ccc3(0,0,0);
label1.position = ccp(winSize.width/2, winSize.height/2);
[self addChild:label1];
【问题讨论】:
标签: iphone cocos2d-iphone uilabel cocos2d-x