Create Match 3 grid properly

Get help using Construct 2

Post » Sun Oct 14, 2012 4:58 pm

Hi, I'm trying to create a match 3 game like Bejeweled as a new project but I'm having trouble creating the initial grid. At the start of the grid I need to make sure there are no 3 tile matches present, only a maximum of 2. This way the game won't start removing 3 matches from the beginning.

I've managed a way around it by adding another colour (the black) to the grid. I've achieved this by getting it to check if the previous two tiles are matching. If they do, add a one to the value of the previous tile.

The problem with this method is, if the previous tile is a 4, adding one makes it 5 and out of the range of animation frames I use for tile colours. To combat this I made another frame and made the colour black. This was so I could clearly see where the adding +1 took the number out of range.

It works fine, with the odd black tile thrown in there, I don't get any set of 3 matches at grid creation, but I don't like it. It's a cop out way of doing things and is untidy.

Can any of you brain boxes work out a way of fixes this?

I've been through the examples on the site and while I get them, they're not done the same as I have done it and I don't want to just copy/paste their work and leave it at that, I like to learn and work out how and what the program is doing.

A little heads up would be great. Here's a screenshot of the program and the CAPX.

Thanks.



CAPXvandinz2012-10-14 17:01:23
B
19
S
5
G
4
Posts: 208
Reputation: 3,960

Post » Sun Oct 14, 2012 11:53 pm

I've noticed that (using a text object to show the values of each array value) when the grid is created on screen, it's done so top to bottom.

What I mean is, the first value of the array is the top left corner, the next value is the one UNDER that ... and so on, then it shifts to the next column and goes down again.

Here's a picture to explain a little. The numbers at the bottom is the value in each array element. They correspond to the image animation frame to give different colours. They match up with the order going DOWN the grid, then across one and down again.



I was under the impression than arrays shift left to right, then down to the next row ... etc. Anyone know why it's going the other way? I think I've been staring at it for too long and can't see the woods for the trees.vandinz2012-10-14 23:58:02
B
19
S
5
G
4
Posts: 208
Reputation: 3,960

Post » Tue Nov 13, 2012 1:58 pm

I'm a little late to this thread, but I thought I'd still point you to my Match 3 tutorial which deals with the creation of the grid:

Match-3 in Construct 2: part one

Also yes, the loop of the array goes through all Y coordinates before moving on to the next X, from top to bottom so to speak. Your observation is correct.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Sat Jan 19, 2013 11:55 pm

PixelRebirth - is there comming a lesson 2?
Ive been spying on your site for quite a while now :D
B
34
S
8
G
7
Posts: 498
Reputation: 7,753


Return to How do I....?

Who is online

Users browsing this forum: Zebbi and 23 guests