Let's say I want to iterate through all tiles in a radius around a tile, but only at a specified distance. For example, let's say I wanted all tiles 3 tiles distant:
What's the fastest way to assemble an array of the tiles marked with "X" when given an arbitrary integer radius?
(Once I have this code, presumably it'd be pretty easy to "search" outwards or inwards from the tile marked *, by passing an incrementing or decrementing radius to the formula.)
Thanks to anyone who can help!
Code:
XXXXXXX
XOOOOOX
XOOOOOX
XOO*OOX
XOOOOOX
XOOOOOX
XXXXXXX
(Once I have this code, presumably it'd be pretty easy to "search" outwards or inwards from the tile marked *, by passing an incrementing or decrementing radius to the formula.)
Thanks to anyone who can help!