First, some
Notes:
It's easier, in this scenario, to use
Two-dimensional Arrays.
I will explain using them...
Problem:That's pretty easy...
- if(get((x + 1) * 8.62, y) == color(0)) //To the right
- if(get((x - 1) * 8 .62, y) == color(0)) //To the left
- if(get(x, (y + 1) * 4.85) == color(0)) //Bottom
- //Etc...
It should be trivial to find the boxes to the top, top-right, bottom-right, etc.
I didn't test the code, but it should work...
Also, why are you using such abnormal numbers for spacing your boxes? (I understand that it fits your window dimensions, but still...)
Most people would use something like 10 or 5...