Sorry with a somewhat specific question, but I'm trying to figure out a concept where I can adapt the ranges for what I have now...

Example - tile (5,4) will get array [(3,3)...(5,5)] as it will be in that array.

Right now, I can use these two functions to generate an array of all the tile positions in the rectangle between (0,0) and (2,2) (I realise I've generated the array twice but one's for a check only) based on if the current tile position is in the array.

Helper function (should determine which 3x3 grid to use)

``````func assume_region_ul():
var tile = get_n_pos()
#var a = 0
#var b = 3
for x in range(0,3):
for y in range(0,3):
var check = []
check.append(Vector2(x,y))
if tile in check:
optionbox.set_meta("temp_pos",Vector2(0,0))
else:
optionbox.set_meta("temp_pos",Vector2(-1,-1))
``````

Main region array function

``````func get_cell_rect(tile_pos):
var rect = []
for x in range(tile_pos.x,tile_pos.x+3):
for y in range(tile_pos.y,tile_pos.y+3):
if get_cell(x,y) != -1:
rect.append(Vector2(x,y))
print(rect)
#print(get_used_rect())
return rect
``````
in Engine
edited

I may be tired, but where's question? What's the problem? Ps: in `assume_region_ul()` in 5 and 6 line you may use just `for a in range(3):`.