How do I combine match 3 and arrays?

Get help using Construct 2

Post » Mon Sep 22, 2014 7:22 pm

Message: Arvoitus is not yet permitted to post plain text URLS (300 rep required). 2 URLS removed. Why?
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.
Posts: 10
Reputation: 250

Post » Mon Sep 22, 2014 7:56 pm

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.
Posts: 226
Reputation: 2,865

Post » Wed Sep 24, 2014 3:45 pm

Alright, I'll dig into this and see what I can make sense of.
Thank you for the help ^^.
Posts: 10
Reputation: 250

Return to How do I....?

Who is online

Users browsing this forum: tarek2, Yahoo [Bot] and 52 guests