O'Reilly logo

Cocos2d Cross-Platform Game Development Cookbook - Second Edition by Siddharth Shekar

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

Chapter 7. Data Storage and Retrieval

The topics covered in this chapter are as follows:

  • Loading the XML file data
  • Saving to the XML file data
  • Loading the JSON file data
  • Loading the PLIST file data
  • Saving the PLIST file data
  • Using NSUserDefaults

Introduction

In this chapter, we will take a look at how to save and retrieve data. It could be simple data, such as storing and comparing high scores, or it could be more complex data, such as level data. For levels, you can store details such as layout, enemy positions, and types, which will be imported when you load the data.

There are different ways in which data can be stored. They can be stored in XML, PLIST, and JSON file types. Each file type stores the same data in a different way. PLIST is more Mac- and ...

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