How to get legal moves in game like Bejeweled/Connect 3? Because I have switching, etc. in place, just can’t make it to detect invalid moves/remove diamonds after making legal ones. I’m using Tilemap for a playfield.
Hi,
You did not really give much detail about your specific case. Perhaps you can screenshot your relevant code, or upload it, and then we can help? The scoring in these kind of games is usually quite easily implemented.
Well, I just don’t know how to check board for “matching” tiles and remove those that match.
I have been trying to figure out the same thing, but I haven’t actually tried it, but the theory I’ve come up with is to use a dotted image set in an overlapping grid, so the outer dots align with the adjacent center dots, like the attached image. Put this dotted grid behind the gems to keep it out of sight. When yellow gem is over the center dot, the dots are yellow. Do +1 to a variable for the gems. When the variable is 3 or more, destroy the gems above the attached dots… or something like that.
Like I said… theory. I haven’t tried it and it could be completely wrong.
Also, unlike the attached image, it would be transparent and the dots should actually align, so it depends entirely on the size of your existing grid.
I hope that if I’m wrong, someone that knows better than me will correct my theory.
This open-source project of mine have some algorithms to find any allowed moves using the most economical path in terms of data processing. It’s not commented (sorry for that), but it’s a functional example.
So, hope it helps.
Actually, that was the first thing I’ve checked. Unfortunately code is too opaque for me to understand. I’d prefer algorithm itself more than an example.