GMS 2 Inactive instances to continue access or global lists

Azenris

Member
Hi just wanted to see your opinion on how you could go about designing this.

Basically, I have machines that can be placed on the floor.

My current system is they all have their variables and what not, but they also have global list data.
When the room ends, the data syncs up to the list.
When you go into another room that doesnt have this object, its data can continue to be manipulated.

The problem with this stragery, is there are two data sets, so I have to constantly think about which im changing, and some functions need designing twice, since sometimes its object instance variables and sometimes the list data.

I can see two options.
1) I move all the data global and dont use any instance variables. The disadvantage with this is while the room is running, i am having to constantly access list data. instead of the previously variable data.

2) move everything into the instance variables and when moving rooms, deactivate them, keep their ids and manipulate them this way. only reactivate when its their room they exist again.


I was just curious how you would go about designing this, maybe another option?

Anyway ty if anyone responds, not a normal programming question. TY
 
So if I understand correctly in the beginning the machines start off as objects, when the room ends they get moved in to global variables, and then in the next room you can continue manipulating that data from the objects and presumably when the player returns to that previous room you would regenerate that machine with the updated data, correct? If I am understanding right, I would maybe just leave it like it is but create wrapper scripts for handling the data and then in those scripts you can do the sorting of which type of object/data to change. Otherwise, just using global vars would probably be my suggestion, I'm not sure how carying instance ids like that would really work.
 

Azenris

Member
Hmm ty for the input, I think I might just stick with as is then, create some more wrapper scripts.
Maybe im freaking out alittle too much about it. I just didnt want to feel like I took the wrong idea too far. Changing it at a later date would be annoying.

Anyway ty
 
Top