Save and Load Game Data
Saving and loading game data is essential for games like Val’s Revenge. Players don’t want to spend a lot of time progressing through a game if their progress isn’t saved.
But saving and loading game data isn’t something you can take lightly. You need to consider what data to save and how to save it.
For a game like Val’s Revenge, you’ll need to save the current level, the number of keys collected, and how much treasure the player found. Because you don’t want nefarious users to “break into” this saved data and make changes, you will securely store it to the file system rather than using NSUserDefaults.[44]
To help speed things up, you’ll be adding a pre-made GameData class.
Open Finder and in the resources folder for ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access