bubble shooter neighbours and falling balls

I’m currently working on a bubble shooter and now got so far that i can shoot bubbles, they stick to a grid when bumped into another ball and Recognizes when there’s a ball with the same color next to it.
Now the problem i’m having is putting these neighbouring balls in seperate list so when there are three or more from the same ball they drop.

Any suggestions?

You can do a simple check :

  1. Shoot bubble_A

  2. bubble_A collide with bubble_B

  3. check for bubble_B around bubbles and continue when they are the same color.

You can make a recursive function that check for every near bubble the color if they are the same as bubble_A you continue until there no same color around.

You put all your same color bubbles in a list or whatever and at the end, when there is no same color bubbles you delete everything.