Saving data into a PLIST file

For the next three recipes, we have three small games that need to have their hi-scores persisted. In this recipe, we see a whack-a-mole game that will use a PLIST file to maintain a list of hi-scores.

Saving data into a PLIST file

Getting ready

Please refer to the project RecipeCollection01 for full working code of this recipe. For the sake of brevity all game logic has been omitted from the following code.

How to do it...

Execute the following code:

#import "ActualPath.h" @implementation Ch2_SavingDataPlist -(CCLayer*) runRecipe { [self loadHiScores]; return self; } -(void) loadHiScores { //Our template and file names NSString *templateName = @"whackamole_template.plist"; ...

Get Cocos2d for iPhone 1 Game Development Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.