Engine: Gamemaker Studio
(simplified) Situation: I have a 6x6 board (at this moment) stored in a 2D matrix, a mechanism for linking adjacent squares, similar to Puzzlecraft, and a button that confirms the link - adding the resources, and destroying the instances of the squares, then moving existing squares and generating new ones.
Question: Is there a way to instantly go through the linked squares, and not just check for any instances marked as linked = true.
Efficiency is in all likelihood not a true concern, especially on this tiny scale, but I'd like to know for the sake of self-improvement more than anything.
Idea for Solving it: I've thought of a way that may be fairly lightweight and quick, I don't know if it is though:
Once a square is added to the link, put the square's position in the matrix in a separate array (one which has 36 slots, in case the entire board is linked). Then once the button to confirm is pressed, it goes up from the bottom of the array, until it reaches a null or -1 value - destroying and setting the value of this array at the appropriate position to null or -1.
Question on the idea: Would this work? How would I store the square's position in the matrix in this array? Would I need to make the array 2D so that it can hold both the x and y position of the square [ie. 0 to 5]?