I have been stuck for awhile now and I'm hoping someone can give me some pointers. I'm working on a game that has a puzzle mechanic similar to a match 3 like candy crush or a bubble blaster game. The part that I am stuck on is recognizing the matches.
I have one sprite in my capx which is called "bug", it is the game token or candy or bubble if that helps for context. In the attached capx example there are 3 bug types each with an idle, hit, panic, destroy, and fall animation all part of the single object. I used an instance variable to identify which bugs are which of the 3 types and it matches with the first part of each animation name. For example type = bee, so beeIdle, beeHit, etc for animation names.
[attachment=0:129dsili][/attachment:129dsili]
How the game should work:
Player touches bug> bug animation changes
Player can stay in touch and move from one bug to the next without taking finger off the game and choose a different bug
All bugs that are the same type touching the currently touched bug (4 direction) also change animation and are matched so on touch release all those bugs and the one being touched would change to the destroy animation and then be destroyed
There is no minimum match, so if the player is touching a bug and there are no touching matches then only that bug would be destroyed. If there was only one touching match then the 2 bugs would be destroyed. So it really isn't a match 3 but it is similar. There is no swapping of bugs or drawing a line to match bugs. Just touch bug and all matched bugs touching that bug will be destroyed on touch release.
I've tried using an array and some recursive type solutions, and I looked at a few plugins and templates. I did not include any of my failed attempts at matching in the example capx since I'm embarrassed none of them seemed to work at all. I have searched the forum and read all that I could find on the subject. It does make me want to learn finite state machines more. Thanks in advance for any support.