GMS 2.3+ How to make a flood fill tool?


I am using layer_sprite_create (not draw_sprite because I like the first better). I know how to make a sprite trace to another sprite but I have no idea how to make a flood fill. I've tried various techniques by googling but none have worked for me. How can this be done? And can it be done in GMS2.3+?


Yes, breadth-first search (aka flood-fill search) is your solution. The starting point of the search is wherever you click, translated to a location in whatever data structure represents your pixels, and the frontier of the search adds in neighbouring pixels with the same color as your starting pixel. When frontier has been exhausted, every same-color pixel that can be reached from the starting point has been processed.

Here's a nice article on the search.