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 ...
Get Apple Game Frameworks and Technologies 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.