O'Reilly logo

Cocos2d for iPhone 1 Game Development Cookbook by Nathan Burba

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Saving data using Core Data

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.

Saving data using Core Data

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...

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required