Scripting a Match Mechanic

I plan to make a game that matches 3 or more of the same color, horizontally and vertically. I have the grid and sprite scripting taken care of, but how should I approach this in a basic form?

In basic, you create either 2d array or array of arrays and fill it with items representing the game field. After every move you iterate through that array and check matches for every item if it has enough equal items in neighbor cells. If so, you destroy that item. Repeat this process until there’s no matches. Then let player make turn again.

Actually this is different, and I failed to mention this, but it’s like Tetris Attack and Columns. But all in all I need an array, right? Do I use something like ‘ifMatched()’ and ‘checkMatch()’?

The difference is very little. In case of tetris, you make turn (move figure down, possible rotate it) programmatically, and everything else remains the same.

Got it. And the array still checks for a match. Well give me a bit, and I’ll pull up the script on my grid class. Show you what I have so far. Maybe we can work out a solution.