Created: 7/31/2014
By: Giorgio Minissale
Email: giorgio.minissale@devco.it
Download Match App - Flag and Zodiac
Thank you for purchasing my code. If you have any questions that are beyond the scope of this help file, please feel free to email. Thanks so much!
Through this application you will be able to simply create your own "Memory Game - Match App" . Just change the graphics of the game and update the IDs of the external services such as Ad RevMob and Appirater Review. The features of the game "Match App" are: Match App - Flag and Zodiac its a free game for iPhone and iPad. Find the pairs as quickly as possible and with the least number of moves. Two levels of play:
The App publishes scores on Game Center , divided into 4 leaderboards.
Completing the game 2 different types of Ad:
The first view allows us to select the gameplay at which to start playing or see charts of the top players on Game Center. Banner at the bottom, above the label with a summary of our best score.
Open Game Center from Home
Graphic Tiles
The sizes of the images for the cards are of two types:
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { self.tiles = [[NSMutableArray alloc]initWithObjects: [UIImage imageNamed:@"iPad_icons_01.png"], [UIImage imageNamed:@"iPad_icons_01.png"], [UIImage imageNamed:@"iPad_icons_02.png"], [UIImage imageNamed:@"iPad_icons_02.png"], [UIImage imageNamed:@"iPad_icons_03.png"], [UIImage imageNamed:@"iPad_icons_03.png"], [UIImage imageNamed:@"iPad_icons_04.png"], [UIImage imageNamed:@"iPad_icons_04.png"], [UIImage imageNamed:@"iPad_icons_05.png"], [UIImage imageNamed:@"iPad_icons_05.png"], [UIImage imageNamed:@"iPad_icons_06.png"], [UIImage imageNamed:@"iPad_icons_06.png"], [UIImage imageNamed:@"iPad_icons_07.png"], [UIImage imageNamed:@"iPad_icons_07.png"], [UIImage imageNamed:@"iPad_icons_08.png"], [UIImage imageNamed:@"iPad_icons_08.png"], [UIImage imageNamed:@"iPad_icons_09.png"], [UIImage imageNamed:@"iPad_icons_09.png"], [UIImage imageNamed:@"iPad_icons_10.png"], [UIImage imageNamed:@"iPad_icons_10.png"], [UIImage imageNamed:@"iPad_icons_11.png"], [UIImage imageNamed:@"iPad_icons_11.png"], [UIImage imageNamed:@"iPad_icons_12.png"], [UIImage imageNamed:@"iPad_icons_12.png"], [UIImage imageNamed:@"iPad_icons_13.png"], [UIImage imageNamed:@"iPad_icons_13.png"], [UIImage imageNamed:@"iPad_icons_14.png"], [UIImage imageNamed:@"iPad_icons_14.png"], [UIImage imageNamed:@"iPad_icons_15.png"], [UIImage imageNamed:@"iPad_icons_15.png"], nil]; } else { self.tiles = [[NSMutableArray alloc]initWithObjects: [UIImage imageNamed:@"icons_01.png"], [UIImage imageNamed:@"icons_01.png"], [UIImage imageNamed:@"icons_02.png"], [UIImage imageNamed:@"icons_02.png"], [UIImage imageNamed:@"icons_03.png"], [UIImage imageNamed:@"icons_03.png"], [UIImage imageNamed:@"icons_04.png"], [UIImage imageNamed:@"icons_04.png"], [UIImage imageNamed:@"icons_05.png"], [UIImage imageNamed:@"icons_05.png"], [UIImage imageNamed:@"icons_06.png"], [UIImage imageNamed:@"icons_06.png"], [UIImage imageNamed:@"icons_07.png"], [UIImage imageNamed:@"icons_07.png"], [UIImage imageNamed:@"icons_08.png"], [UIImage imageNamed:@"icons_08.png"], [UIImage imageNamed:@"icons_09.png"], [UIImage imageNamed:@"icons_09.png"], [UIImage imageNamed:@"icons_10.png"], [UIImage imageNamed:@"icons_10.png"], [UIImage imageNamed:@"icons_11.png"], [UIImage imageNamed:@"icons_11.png"], [UIImage imageNamed:@"icons_12.png"], [UIImage imageNamed:@"icons_12.png"], [UIImage imageNamed:@"icons_13.png"], [UIImage imageNamed:@"icons_13.png"], [UIImage imageNamed:@"icons_14.png"], [UIImage imageNamed:@"icons_14.png"], [UIImage imageNamed:@"icons_15.png"], [UIImage imageNamed:@"icons_15.png"], nil]; }
Below is the method that handles shuffle the cards, can be found in the files GameFlagViewController.m line 185:
- (void)shuffleTiles { int tileCount = (int) [self.tiles count]; for (int tileID = 0; tileID < (tileCount/2); tileID++) { [self.shuffledTiles addObject:[NSNumber numberWithInt:tileID]]; [self.shuffledTiles addObject:[NSNumber numberWithInt:tileID]]; } for (NSUInteger i = 0; i < tileCount; ++i) { NSInteger nElements = tileCount - i; NSInteger n = (arc4random() % nElements) + i; [self.shuffledTiles exchangeObjectAtIndex:i withObjectAtIndex:n]; [self.tiles exchangeObjectAtIndex:i withObjectAtIndex:n]; } }
This app contains two different types of AD:
The iAd banner is shown in all the movies at the bottom of the app, is initialized in the class "ViewController".
Configure RevMob
#import RevMobAds/RevMobAds.h
[RevMobAds startSessionWithAppID:@"copy your RevMob App ID here"];
- (void)applicationDidBecomeActive:(UIApplication *)application { [[RevMobAds session] showFullscreen]; }
[[RevMobAds session] showBanner];on viewDidLoad
For more information, go to official: SDK iOS RevMob
Appirater is a class that you can drop into any iPhone/iPad app that will help remind your users to review your app on the App Store.
Settings, inside AppDelegate.m, kAppiraterAppID it's your App ID provided by itunes connect.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. [RevMobAds startSessionWithAppID:kRevMobAppID]; // [RevMobAds session].testingMode = RevMobAdsTestingModeWithAds; // Appirater [Appirater setAppId:kAppiraterAppID]; [Appirater setDaysUntilPrompt:10]; [Appirater setUsesUntilPrompt:3]; [Appirater setSignificantEventsUntilPrompt:-1]; [Appirater setTimeBeforeReminding:2]; //[Appirater setDebug:YES]; [Appirater appLaunched:YES]; return YES; }
How to create leaderboards and achievements:
Leaderboards in my app is a “Top Score” ranking, divided into three tables, one for each level of difficulty, and one unique Fruit Leaderboard
Leaderboards Step
Add one or more language on “Leaderboard Localization” :! Click “Add Language”, select “English” .
Add Leaderboard ID on this file GameFlagViewController.m:
- (void) winner { [bestime invalidate]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; int highScore = (int) [defaults integerForKey:@"highScore_flag"]; int besttimeEver = (int)[defaults integerForKey:@"bestime_flag"]; if ([levelType isEqualToString:@"MOVES"]) { if ((highScore == 0) && (self.guessCounter > 0)) { [defaults setObject:[NSNumber numberWithInt:(int)self.guessCounter] forKey:@"highScore_flag"]; self.gameScoreLabel.text = [NSString stringWithFormat:@"New best score! Guesses: %ld", (long)self.guessCounter]; [[GameKitHelper sharedGameKitHelper] reportScore:(int)self.guessCounter forLeaderboardID:kLeaderboardFlagMoves]; } else if (highScore > self.guessCounter) { [defaults setObject:[NSNumber numberWithInt:(int)self.guessCounter] forKey:@"highScore_flag"]; self.gameScoreLabel.text = [NSString stringWithFormat:@"New best score! Guesses: %ld", (long)self.guessCounter]; [[GameKitHelper sharedGameKitHelper] reportScore:(int)self.guessCounter forLeaderboardID:kLeaderboardFlagMoves]; } else self.gameScoreLabel.text = [NSString stringWithFormat:@"Game over. Guesses: %ld", (long)self.guessCounter]; } else { if ((besttimeEver == 0) && (seconds > 0)) { [defaults setObject:[NSNumber numberWithInt:seconds] forKey:@"bestime_flag"]; [[GameKitHelper sharedGameKitHelper]reportScore:seconds forLeaderboardID:kLeaderboardFlagTime]; } else if (besttimeEver > seconds) { // New record! [defaults setObject:[NSNumber numberWithInt:seconds] forKey:@"bestime_flag"]; [[GameKitHelper sharedGameKitHelper]reportScore:seconds forLeaderboardID:kLeaderboardFlagTime]; } else self.gameScoreLabel.text = [NSString stringWithFormat:@"Game over. Seconds: %d", seconds]; } }
Giorgio Minissale