Game Development Community

Match 3

by Martyn · in Torque Game Builder · 06/02/2009 (8:59 am) · 1 replies

Hi

At the moment I am looking at 2 possibilities

A Break Out Game or a Match 3 game. Both being simple game play games. I know their is a breakout tutorial but I would prefer just to "go for it" and see how I go as I have already attempting many tutorials.

In regards to the Match 3, what would be the best way of doing it so that the game recognises that their are 3 of the same object?

Thanks for any suggestions

About the author

I have been interested in game development for around 10 years, it has always remained a hobby. I am now looking to develop my skills and maybe progress it from a hobby into a 2nd income.


#1
06/02/2009 (3:34 pm)
When creating an object, tag a type field to it. And add those object to an array that you can refer to using it's row and column value.

%objectA.type = 1;
$gridData[0, 0] = %objectA;

%objectB.type = 2;
$gridData[1, 0] = %objectB;

When checking if there is a match

for(%row = 0; %row < %maxRow; %row++)
{
   for(%col = 0; %col < %maxCol - 2; %col++)
   {
       if($gridData[%col, %row].type == $gridData[%col + 1, %row].type 
          && $gridData[%col, %row].type == $gridData[%col + 2, %row].type)
       {
           error("yep we have a match!");
       }
   }
}

This check if there are any matches in 1 row, you have to check the column too. Good luck!