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

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.