-
Book Overview & Buying
-
Table Of Contents
Cocos2d for iPhone 1 Game Development Cookbook
By :
Our third game is a memory card game where you must flip over sets of cards. Flip over two matching cards and you get a point. Flip over two that don't match and you get a strike. Three strikes and you're out. For this game we persist hi-score data using Apple's Core Data model pattern.

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.
Setting up our Core Data based recipe requires a number of steps.
First we need to add the CoreData framework. You can do this by right clicking on your project and going to Add > Existing Frameworks and then, under iOS 4.x SDK, select CoreData.framework.
Create a new folder inside your resources entitled Data Model. Inside this folder, create a class entitled Hiscore, which derives from ManagedObject:
//Hiscore.h #import <CoreData/CoreData.h> @interface Hiscore : NSManagedObject ...
Change the font size
Change margin width
Change background colour