Saving/Loading values associated with objects

Get help using Construct 2

Post » Fri Mar 29, 2013 9:41 pm

Hi All,

I'm working on a saving/loading system for my game. Right now, I store instance variables in several objects. I'd like to be able to save these values to an array, stick the array into storage, and at a later time, load the array from storage, and reassign all the instance variables.

I'd rather not have to manually code each different object's instance variables being added to/loaded from the array as some of my objects have quite a few instance variables. It would be handy if instance variables were indexed, and there were an expression to reference them by index. That way, I could loop through each instance variable's index to save to/load from the array.

A work around I've been thinking about is getting rid of instance variables altogether, and just using arrays. I would create an array per object to hold the values that are currently stored in instance variable. That way, I could loop through the array to save/load these values. I guess my questions is, "Has anyone found a better method for saving/loading values associated with objects"?

zatyka2013-03-29 21:42:57
Posts: 341
Reputation: 12,510

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 19 guests