Match3 logic [Need help]

0 favourites
  • 13 posts
From the Asset Store
100 items casual and logic games. All icons are of a high quality.
  • the capx

    I need help with the logic in match3-like game.

    What I do: on touched the object I call 4 functions wich go in 4 dirrections (up, down , left , right) though array. every func check the value in array and if this value equal to choosen object - I spawn destroyer at this position, else - stop loop.

    But it show terrible result. Hope on you, guys!

  • Hello!

    I've tried to fix your capx, and here's what I came up to link.

    I works a bit better.. a tiny bit:( Still needs fixing.

    May be you'll find a way to make it run as intended:)

    I'll keep trying too, and I'll let you know if I find a solution ^_^

    UPD: Allright, I've tried another way and kinda got it running:) Example 1

    So.. the answer is.. Tilemaps! :D God I love them.

    In this particular case, using a single tilemap replaces both Array and Sprites

    and saves us from some pain-in-the-butt with our code.

    Well my example works pretty fine, I guess.

    But! It now deletes only those tiles that are in the same row/col with the tile we click.

    And I think we need to check if every tile we delete has 3matching tiles..

    Sorry, hard to explain, I hope you get the idea:)

    To do this, we need a simple recursion.. but seems it's not working :((( Or I'm just doing something wrong :P

    Please let me know if you find how to fix it!

  • Oh, thanks ! I'm still trying.

    Here I'm not start build the events from checking if we have 3 in a row or not.

    But I don't understand why my logic doesn't work. It simple go from top to bottom and from side to side and check the same value. What's a thing I loose ?

  • It simple go from top to bottom and from side to side and check the same value. What's a thing I loose ?

    I guess..

    In your "up" function, you had "for i from 0 to param()"

    Where I made it "for i from param() to 0", so it starts counting from param() and decrements to 0. Same for "left" I guess that might be the problem)

    P.S. Updated my first post with a fine working example:)

  • from 0 to param(1) in for loop just change the loopindex. In action I make (param(1) - loopindex) which the same what you mean

  • Here's a new version, getting closer.. Example 2

    But it is still glitchy and overcomplicated:(

    There must be an easier and more stable way! I feel it:P and I'll find it >:D

    UPD: I guess I've fixed it :) Example 3

    It still needs optimization, but at least it's working now)

  • Oh, amazing) But I going to turn back to arrays. I loose smth and can't see some hiden little thing in my logic.

  • Same here, after a couple of hours of brainfu[storm]ing I've figuired out that it shoud be easier to do with arrays <img src="smileys/smiley26.gif" border="0" align="middle" />

  • You really should either go with arrays or use rexrainbows set of plugins (which come with capx examples btw).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • PixelRebirth I totally agree:)

    It's just me, as a novice in C2 and general programming, always trying to "roll my own" solution instead of using examples:P

    Sometimes useful, mostly- complete waste of time^^

  • PixelRebirth I totally agree:)

    It's just me, as a novice in C2 and general programming, always trying to "roll my own" solution instead of using examples:P

    Sometimes useful, mostly- complete waste of time^^

    Understandable! <img src="smileys/smiley1.gif" border="0" align="middle" />

    I still prefer to use my own array-based Match-3 engine as well.

  • PixelRebirth Ah-oh teach me nao! Jk:)

    Actually, I'd really appreciate if you could point me in a right direction:

    1)Do you have a single Array? Is it 2d or 3d?

    And if it's 3d.. how "deep" is your array? (ouch this might sound wrong:P)

    2)Do you use recursion? Functions or just events&loops?

    Thanks in advance^^

  • PixelRebirth Ah-oh teach me nao! Jk:)

    Actually, I'd really appreciate if you could point me in a right direction:

    1)Do you have a single Array? Is it 2d or 3d?

    And if it's 3d.. how "deep" is your array? (ouch this might sound wrong:P)

    2)Do you use recursion? Functions or just events&loops?

    Thanks in advance^^

    1) I do have a couple of arrays. One for the playfield which is 3d with a depth of 2. It has an additional layer for marking blocks to be destroyed so to speak.

    The second array is 1D and being used dynamically. Sort of a queue or tasklist. Basically the game checks this array for entries, calls that function and removes the entry afterwards. If theres nothing left to do the player may interact again.

    2) Functions of course. I would argue they are essential for any serious game made in C2. Without them you will end up getting clunky and overcomplicated events for sure.

    There are also loops and recursive functions, so yeah. You'll end up using all of that naturally. <img src="smileys/smiley2.gif" border="0" align="middle" />

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