Presenting Match GUI
We begin by first working with the standard matchmaking GUI provided to us by Apple. Start by first adding a new button to handle presenting the view on the main screen of our test game. I have also gone ahead and renamed the old Play button to Single Player, and created a new button called Multiplayer (see Figure 5–1). We will use the UFOViewController to act as the delegate for our matchmaking behavior, so set the view controller to conform to GKMatchmakerViewControllerDelegate. Additionally, modify the action method of the multiplayer button we just added to match the following code.
- (IBAction)multiplayerButtonPressed;
{
GKMatchRequest *request = [[GKMatchRequest alloc] init];
request.minPlayers = 2; request.maxPlayers ...
Get Beginning iOS Game Center and Game Kit: For iPhone, iPad, and iPod touch now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.