Tutorial 3 – Saving Game State (Iphone Game Tutorial Cocos2d)
April 13, 2010 14 Comments
Well its day 44 of my Iphone game developing and I decided to do a third tutorial. This tutorial describes how I save the game state to the device which is an extremely important feature to include with your game (or any application for that matter).
This is actually very easy to do using NSCoder and I will describe what I have done in this 20 min video located below. Also in the video is a quick preview of what my game “Planet One” is looking like at day 44.
The video shows how I have accomplished this on my game using a singleton class. I found that using a singleton class is the best thing for my entire game, it has helped me in so many ways and now it has made my life easy for saving game state. You can still follow the video even if you are not using a singleton class as the meat of the code is always the same. BUT I would recommend to everyone – Make Yourself a Singleton Class!!
UPDATE FOR VIDEO: In the video I show the decoder (re-loading the saved data) located in my menu class, BUT after making the video I realized that this was not a good spot for decoding since the menu screen can be accessed at any time by the user. Sooo…this is an easy fix I just moved the code from that class to the
– (void) applicationDidFinishLaunching:(UIApplication*)application
in the AppDelegate.
This was a simple fix for a problem caused my my coding late late into the night. I was not paying attention (or thinking straight ) last night I guess, but all is good now.
Anyways enough talk, lets get to the video!
Tutorial 4 Video – Saving game state:
Please Leave Comments Below