[How Do I] Match 3 ?

Get help using Construct 2

Post » Thu Mar 21, 2013 11:53 am

Hello everyone!
Last night, I worked on a capx from 7:00PM to 3:00 AM and didn't get what I wanted.

I need to create Match3 mechanics for my game.

I began with creating an array (6,6,1) where the values are Int(Random(4)).
Then, for each XY, I create an instance of "Gem" (sprite with 4 animations, each being a color). The color is decided by the Int(Random(4)) value (0=Blue, 1=Yellow, 2=Red, 3=Green).

So, I got a 6x6 board of gems.

But I need to know if 3 or more cells of the same color are touching.
So I created an instance var for "gem" that stores the animation name (color), a Global variable called "PreviousColor" and another called "clickCount".

If clickCount = 0, create a "selection" object over the clicked Gem, store the Gem color in the PreviousColor global var, set clickCount to 1.
If clickCount =/= 0, check if PreviousColor = Gemme.Color

The rest of the code is gibberish: newbie attempts to check when same color if both gems are connected, and that doesn't work.

Since I'm a Newbie and don't know any javascript, I'm wondering if it is possible to make a Match3 game at all, especially when it comes to checking same and adjascent array values.
Posts: 13
Reputation: 303

Post » Thu Mar 21, 2013 12:34 pm

Check out these plugins, courtesy of rexrainbow, they make doing games like that quite effortless: http://www.scirra.com/forum/plugin-matcher_topic57512.html

Demo: http://www.scirra.com/forum/bejeweled-plugins-demo_topic62447.html
Posts: 756
Reputation: 7,182

Post » Thu Mar 21, 2013 1:00 pm

I'm trying to do a game, which uses Match 3 mechanics too. Yesterday I found:


It takes only five events to generate grid with random objects. Shame there isn't part two (and most likely won't appear), because I'm a beginner too.

Now I struggle with proper swaping of them.

EDIT: Thanks, vee41, for these links!Bluehardt2013-03-21 13:22:25
Posts: 1
Reputation: 277

Post » Thu Mar 21, 2013 1:20 pm

Meh. My previous message hasn't been sent and was deleted on refresh...

@vee41: I'll try that, but I would prefer to understand what I'm doing. Thanks, though, it could be interesting.

@Bluehardt: been there. I think the trick of the "string to generate randomness" is a little bit too much, though. Did the same thing with the Array value at (X,Y) is (Int(random(4)) and the random integer determines the color.

I wonder if adding a Z-axis to my array could help if I do this:
the value at (X,Y,2) is 0 on start of layout.
Then, for each element of the array, I compare the value with the previous, the next, the one above and the one below (so I compare (X,Y) with (X-1,Y), (X+1,Y), (X,Y-1) and (X,Y+1). If the value at (X,Y) and any of those is the same, I add 1 on (X,Y,2).
That way, I could trigger events if Z>=3...
Posts: 13
Reputation: 303

Post » Fri Mar 22, 2013 2:01 am

Posts: 3,043
Reputation: 20,485

Return to How do I....?

Who is online

Users browsing this forum: beardman, Dodgger, IGDev, mariogamer, OddConfection, Tristap and 4 guests