Thursday, April 19, 2007

Saving

This week I got saving working, the processes is a bit convoluted, but it works:
1. The Story.Scene class was amended to add a private array of scene references. This array is static in the class, in other words it is a constant as the program runs.
2. As each scene is instantiated, it is added into the array of scenes, and each instance is added an id that corresponds to the array index.
3. When saving (SharedObject class), the id of the current scene is saved as a number. The state object can be saved normally, as it is a native data type.
4. When opening the program, if the SharedObject exists, it is used to begin the story, if not, the default beginning state is used.

All that's left for me to do is work on printing at this point. So my timeline is looking good.




No comments: