Match-3 mechanics

For questions about using Classic.

Post » Fri Nov 06, 2009 5:51 pm

[quote="PixelRebirth":2k65ua5x]Of course I'd be happy to help you setting up your own puzzle game. Would you mind sharing a cap of your current progress (either openly or PM)? That would be a good starting point to do some of my "amazing" explaining.[/quote:2k65ua5x]
I think this topic is useful for many people so I suggest to share cap files right here.

Here is my project:

'cap' file
'exe' file

There are simple pieces in the game just for example, because original pieces is in the process of designing. It remains to realize only two things: destroying pieces when the same three together, and resp. spawning of new blocks.

If you know how to make this please help me.

P.S. PixelRebirth, I very much like your game, if you could to share your mechanics I would be very grateful...
B
3
S
2
G
3
Posts: 146
Reputation: 1,567

Post » Fri Nov 06, 2009 9:03 pm

Okay MJ, thanks for sharing!

[quote="Mary Jane":st3bcvt4]It remains to realize only two things: destroying pieces when the same three together, and resp. spawning of new blocks. [/quote:st3bcvt4]

Actually you would still need to set up the playfield generation in a way that there wouldn't be 3 matched at the beginning. Unless you want that for some reason.

[quote="Mary Jane":st3bcvt4]If you know how to make this please help me.[/quote:st3bcvt4]

I do know. I can't simply explain it in a few phrases I'm afraid. Will take a little more than that.

For starters: Add an array, use X and Y size of the array as the dimensions of your playfield.
In your cap it's 8x8 for example. Now don't put any blocks in your layout at the beginning, but create them on startup for each element of the array. For positioning you could use any object as reference point. Now loop through the blocks X over Y ascending and check always for the blocks which are positioned one and two units left and above the current block. If for one direction both match you'll randomize the block until both don't with a while loop.

That would be the beginning generally speaking... but as I mentioned typing everything out like that is very theoretical and I'm not a novelist either. :P

So what I will do is either implement it in your cap or more likely create a basic commented example of my engine. Either way, it'll take a bit of time. I'll see to it over the weekend. Have a little patience. :)
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Fri Nov 06, 2009 10:37 pm

id think using a simple collision detection mechanic with offset collisions tests for the part you move would work.
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Sat Nov 07, 2009 7:33 am

[quote="PixelRebirth":1xbx0u91]So what I will do is either implement it in your cap or more likely create a basic commented example of my engine. Either way, it'll take a bit of time. I'll see to it over the weekend. Have a little patience. :)[/quote:1xbx0u91]

I do not really understand how to work with Array, so I better wait for your example.
B
3
S
2
G
3
Posts: 146
Reputation: 1,567

Post » Sat Nov 07, 2009 11:36 am

Well, you have to take chain and more-than-3 elimination into account. The premise is simple, but execution - especially smooth and failproof - can be a little tricky.

It can be done with simple condition checking (if a bit slower than array):
For each block on the field, check if it has any neighboring blocks of the same color. If it finds one, check that block's next neighbor - that is in the same direction. If there is one, mark for demolition. Do this for EACH block on the field.

Then, once checks are done, start the demolition. Whee! Fireworks! After that, collapse the pieces or whatever and repeat the check, until there are no blocks that meet the condition, then allow the player's input.

This method has the advantage of streamlining; you can use fancy animations and stuff!

Pseudo code:
+For each block
- Are any of its four neighbors of the same color?
- Check that block's adjacent block, that is in the same direction
> Mark these blocks for demolition
>When done checking all blocks, DEMOLISH! Then re-check all blocks until NONE are marked for demolition and wait for player's move.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sat Nov 07, 2009 11:46 am

[quote="Mipey":3ozytdg5]Pseudo code:
+For each block
- Are any of its four neighbors of the same color?
- Check that block's adjacent block, that is in the same direction
> Mark these blocks for demolition
>When done checking all blocks, DEMOLISH! Then re-check all blocks until NONE are marked for demolition and wait for player's move.[/quote:3ozytdg5]

Mipey's theory would absolutely work. But you probably wouldn't want to check all blocks. Just those that have been moved or rather the rows and columns of those blocks.

That's the stuff I added to mattdubs cap in the mentioned thread. It's just not destroying there, but changing opacity for testing.

It's not a whole lot different from what I'm doing anyway. I just happen to involve an array to a certain extent.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Sat Nov 07, 2009 11:51 am

Yeah, I suppose only checking "moved" or "freshly spawned" blocks would work, though it doesn't really matter on a 8x8 or even 12x12 board.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sat Nov 07, 2009 6:01 pm

[quote="Mipey":32pwtf0p]
Pseudo code:
+For each block
- Are any of its four neighbors of the same color?
- Check that block's adjacent block, that is in the same direction
> Mark these blocks for demolition
>When done checking all blocks, DEMOLISH! Then re-check all blocks until NONE are marked for demolition and wait for player's move.[/quote:32pwtf0p]

I don't know how to make it. I don't know what conditions and actions must be. Could you make an example?

[quote="PixelRebirth":32pwtf0p]That's the stuff I added to mattdubs cap in the mentioned thread. It's just not destroying there, but changing opacity for testing.[/quote:32pwtf0p]

Where can I download this ''cap'' file?
B
3
S
2
G
3
Posts: 146
Reputation: 1,567

Post » Sat Nov 07, 2009 6:05 pm

[quote="Mary Jane":29fo6v4k]Where can I download this ''cap'' file?[/quote:29fo6v4k]

It's hidden inside that thread. :D
Here you go: Download
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Sat Nov 07, 2009 6:46 pm

[quote="PixelRebirth":3byk14h3]It's hidden inside that thread. :D
Here you go: Download[/quote:3byk14h3]

Thank you for the example, but I could not understand it. :(

Maybe is there another simpler way? :roll:
B
3
S
2
G
3
Posts: 146
Reputation: 1,567

PreviousNext

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests