0 Favourites

Saving/Loading values associated with objects

  • 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"?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)