Match same instances based on color, while not sitting in a grid

I am new at gDeveloper. I am learning the tool, while building a game. I have created instances of an object, as well as others. I have given them all unique IDs, assigned a variable for color, and then a boolean of whether or not the object instance is connected.

I am trying to create a “simple” match game (similar to candy crush), but not in a grid. The objects are piled using Physics 2. If same color is in collision (or near) I want to target those objects, match and delete them. As you probably guessed, the collision between instances of an object is problematic. I have used multiple variations of variables including arrays. I am still having issues.

The examples that I see are designed using a grid, which is not the desired effect I am looking for. Would you mind pointing me in the right direction? Any help or guidance is very welcomed. Thanks!

There is an example that does something like this so I guess it’s possible but I don’t know how it works as the code is not free, but you can play it for free:

This is exactly what I was looking for. I really appreciate your help!