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 into an SQLite database

The second game we have is a "skeet shooting" game where discs are fired in the air and the goal is to shoot as many down as possible within a certain time limit. For this game, we will persist hi-score data using a SQLite database. We will be using the FMDB Objective-C SQLite wrapper to access the SQLite database within our code and the Firefox plugin SQLite Manager to create an initial database file.

Saving data into an SQLite database

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

To use SQLite we ...

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