Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
- (void)endGame
{
if (playing) {
playing = NO;
[self hideButton];
[self.playPauseButton setTitle:@"Play" forState:UIControlStateNormal];
if (score > highScore) {
highScore = score;
[[NSUserDefaults standardUserDefaults]
setObject:[NSNumber numberWithInt:highScore]
forKey:@"highScore"];
}
UIAlertView *alertView =
[[UIAlertView alloc]
initWithTitle:@"Game Over!"
message:[NSString stringWithFormat:@"You scored %d",score]
delegate:self
cancelButtonTitle:@"Try again"
otherButtonTitles:nil];
[alertView show];
[self resetGame];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.