Search code examples
objective-ccocos2d-iphone

Update Label Value in Cocos2d


I am making a game in cocos2d , In that while updating score the old score values get on the label and the new value get overwritten. I m using following code to display the score,

LblScore = [CCLabel labelWithString:[NSString stringWithFormat:@"%d",score]
                         dimensions:CGSizeMake(100, 300) 
                          alignment:UITextAlignmentCenter  
                           fontName:@"Arial" 
                           fontSize:32.0];

Because of this the score value are not shown and all things get massed up, If any one having idea how to update new score?


Solution

  • The Solution for my problem is , I must have to define the label declaration in the -(id)init method, there on the value provided from any where there will be no overwriting of the values.

    I've tried it and it's working, But still thanks to all who provided me a help