How do I combine match 3 and arrays?

0 favourites
  • 3 posts
From the Asset Store
snake and ladder game with two characters: turtle and rabbit!
  • I'm looking to create a match 3 game.

    While I've created one using tut, I found that's it's clunky and slow, once you get past a certain speed. While speed isn't too much of an issue given that the game will be level based, it is still a problem, especially with that many events, and things to be called.

    So I went hunting and through various bits of the internet and found the idea of using arrays to create a match 3 game. Several posts were here on the forums, although from so long ago, I didn't want to necro them looking for advice. Which led me to wonderful tut. Except... this one was abandoned after that first post.

    I refuse to give up though on my idea, so what I need to ask you wonderful people is:

    1. Can I combine the instructions from the first test (working solely by functions) into the concept of an array?

    2. Is there anything I can read to further explain what an array is and /how/ it can be applied, not merely theoretical as the manual is?

    3. If array's aren't possible, is there an option to replace checking 'every tick' for matches? I tried out several others, but they.. weren't possible.

    Many thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • An array is a great way to hold the data and information to keep track of where objects are.

    I would would use a number to represent each tile.

    Let's say I have tile 1, 2, and 3

    The array holds the game field and values are 1-3

    Think of an array like a grid. Or game of battleship.

    for this problem I would use nested for loops to navigate the array.

    For(int I is less than array sizeY)

    For(Int Y is less than array sizeX)

    check if there is a match across ArrayX

    If not, check for a match on arrayY

    If you want to get into performance optimizations. Do a full check every once in a while. Otherwise only check where there are changes in the array. No need to check the whole thing all the time. Once should be good.

  • Alright, I'll dig into this and see what I can make sense of.

    Thank you for the help ^^.

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