I have a screenfull of clones of equal size (12x12) blocks of two colors. I want to determine the touching ones in order to group them into areas.
When I try NEIGHBOR logic, I get lists of neighbor clones of varying numbers for the corner pieces, even though the distribution is even:
BL: 7 (bottom left)
BR: 8
TL: 8
TR: 6
I don't understand why there is a difference.
Same kind of thing happens for the edge and center clones, where adjacent ones report different number of neighbors...
The neighbors algorithm is dependent on the extent of the sprite that asks for them. I'm currently too lazy to look up the specifics in my code, but the rule is that there's some relationship between the sprite's area to the surrounding box that it scans for neighbors. The neighbors attribute is meant not so much to perform statistics on surrounding populations but to narrow-down potential collision candidates, or to find the nearest one. If you want a configurable circular view of "neighbors", you can use something like this: