For the persistence of user settings and other small bits of data, the iOS framework provides the NSUserDefaults
class. In this example, we are saving the default difficulty level for our game.
Execute the following code:
@implementation Ch2_SavingSimpleData -(CCLayer*) runRecipe { //Set font size [CCMenuItemFont setFontSize:30]; //Add main label CCLabelBMFont *chooseDifficultyLabel = [CCLabelBMFont labelWithString:@"CHOOSE DIFFICULTY:" fntFile:@"eurostile_30.fnt"]; chooseDifficultyLabel.position = ccp(240,250); chooseDifficultyLabel.scale = 0.5f; [self addChild:chooseDifficultyLabel z:1]; //Add difficulty choices easyMIF = [CCMenuItemFont itemFromString:@"Easy" target:self selector:@selector(chooseEasy)]; /* CODE OMITTED */ mainMenu = [CCMenu menuWithItems:easyMIF, mediumMIF, hardMIF, insaneMIF, nil]; [mainMenu...