While languages such as C and C++ have pointers, Object-Oriented programming language like Java have instance identifiers to reference existing class instances.
Game Maker: Studio provides any existing instance with a built-in variable:
id. An instance
id is used to "talk to" a particular instance of an object among the others currently in the room.
I'm assuming that by assigning an instance to an array you mean to save a reference to a given object within an array. As you create your gems - for example in a
for statement - you can add a line to the code block to save the id of the new instance:
for (var i=0; i<n; i++)
// Other code of yours //
my_inst = instance_create(dx,dy,obj_Jewel);
array_id[i] = my_inst.id; // OR: array_id[i] = my_inst;
// Even more code
Of course, you can expand this code to make it work with 2D arrays if you need to, even with data structures.
You can save an instance
id by asking for its variable, but remember you get its
id right when it is created by using the function
instance_create(), as it is the return value of the function.
Once you get all your
ids in the array, you can perform all the game logic as you will.