Skip to content

Instantly share code, notes, and snippets.

@alinradut
Created April 17, 2011 18:35
Show Gist options
  • Select an option

  • Save alinradut/924332 to your computer and use it in GitHub Desktop.

Select an option

Save alinradut/924332 to your computer and use it in GitHub Desktop.
Achievements - Games won
- (void)updateGamesWon {
gamesWonInARow_++;
if (gamesWonInARow_ && (gamesWonInARow_ % 10 == 0 || gamesWonInARow_ == 5)) {
NSInteger bonus = score_* ((float)gamesWonInARow_ / 100);
score_ += bonus;
NSString *achievement = [NSString stringWithFormat:@"%d games in a row! (+%d)", gamesWonInARow_, bonus];
[self achievementUnlocked:achievement];
}
[scoreLabel_ setString:[NSString stringWithFormat:@"Score: %d", score_]];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment