I've made an app that plays Yahtzee. Everything works fine except for saving the user's high score. Here's the code that gets called when the user is out of turns:
Every time the game end, the new high score always becomes the user's score for that game, even if they didn't beat the high score. Could someone please help me?
Code:
highScore = [[NSUserDefaults standardUserDefaults] integerForKey:@"Hight Score"];
if (score>highScore) {
[[NSUserDefaults standardUserDefaults] setInteger:score forKey:@"High Score"];
[[NSUserDefaults standardUserDefaults] synchronize];
[highScoreLabel setText:[NSString stringWithFormat:@"High: %d", score]];
}