How do I detect a closed area in a grid?

Get help using Construct 2

Post » Wed May 07, 2014 12:35 pm

So, I have an 8x8 grid, set up with an array.

Each tile has a value of 0 or 1 depending on whether it is active or not.

When an area of 0's is bound by a shape (not necessarily a box) I want it to detect this and turn it to active (1's)

I have it working by first checking the edges- if they are all 1's then bingo, it's a big square.

If not, I'm doing a search from the outside edge with a kind of flood fill but it is quite slow.

Anyone know a quicker way?
Posts: 19
Reputation: 1,173

Return to How do I....?

Who is online

Users browsing this forum: savvito123, UberLou and 4 guests