我使用了来自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];