The high score isn’t staying on screen at all so the big problem is what do I do so the score will stay on screen until it is surpassed and will update score like a high score.
I have taken advice from another user couple days ago that made it seem simple ,but when I tried to do it didn’t work out. I tried pretty much all the different types of combinations and no beans. So looks like I need someones help pointing out the error.
init
_oldScore = [[NSUserDefaults standardUserDefaults] integerForKey:@"score"];
CGSize winSize = [[CCDirector sharedDirector] winSize];
self.scoreLabel = [CCLabelTTF labelWithString:@"" dimensions:CGSizeMake(100, 50) alignment:UITextAlignmentRight fontName:@"Marker Felt" fontSize:32];
_scoreLabel.position = ccp(winSize.width - _scoreLabel.contentSize.width, _scoreLabel.contentSize.height);
_scoreLabel.color = ccc3(255,0,0);
[self addChild:_scoreLabel z:1];
implementation
if (_score > _oldScore) {
[[NSUserDefaults standardUserDefaults] setInteger:_score forKey:@"score"];
[_scoreLabel setString:[NSString stringWithFormat:@"score%d", _score]];
So far it works great, and everything but the oldscore won’t stay on the screen. I want the player to know what the high score is.
The user said make a new nsuserdefaults with a different key to store old score. So that way old score with the highest score will stay on screen.
// To save score in preference
// To get saved value from preference
//To set score value to ur cocos2d label