Game Development Reference
In-Depth Information
presentModalViewController:animated: on self , which will display the Leaderboard view. In order
to remove the leaderboard when the user clicks Done, set self as the leaderbordDelegate , which
means the task leaderboardViewControllerDidFinish: from GKLeaderboardViewControllerDelegate
will be called when the user is done. The implementation leaderboadViewControllerDidFinish:
should be as follows, shown in Listing 9-4.
Listing 9-4. RootViewController.m (leaderboardViewControllerDidFinish:)
- (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController{
[self dismissModalViewControllerAnimated:YES];
}
leaderboardViewControllerDidFinish: , where we
dismissModalViewControllerAnimated: to remove the Leaderboard view from the screen.
Figure 9-8 ). In our sample game, Belt Commander, the player destroys wave after wave of asteroids.
We want to give the user an achievement when he destroys his first 10 asteroids—an easy
achievement, which will remind the user early in the game that there are other achievements to earn.
Figure 9-11 shows the achievement in the Game Center app.
 
Search WWH ::




Custom Search