Search code examples
game-makergml

How would I implement the flood fill algorithm in GameMaker?


So, I have implemented cellular automata into one of my games in GameMaker. But there are tons of disconnected caves... So does anyone know how to implement an algorithm like Flood Fill?


Solution

  • Have your automata check their immediate neighbours (the four pixels above, below, left and right). If the checked neighbour is the colour they're targeting, spawn an automaton there.