Create Match 3 grid properly

0 favourites
  • 4 posts
From the Asset Store
Snap to visible grid - perfect solution for any game genre
  • 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.

    <img src="http://s13.postimage.org/681e8mfsn/blocks.png" border="0">

    CAPX

  • 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.

    <img src="http://s17.postimage.org/i3jmu5gpr/path.png" border="0" />

    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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • PixelRebirth - is there comming a lesson 2?

    Ive been spying on your site for quite a while now :D

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)