0 votes

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 = []
            if tile in check:

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:
    return rect
in Engine by (33 points)
edited by

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):.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.