Hy everyone,
I have a code that needs to retrieve an array containing arrays. When I test, it gives me [[Reference:1261]]. but it doesn't indicate any error. The code is meant to make an edge-based astar to block certain directions. I use a tilemap
A class to hold information :
class Wall:
var Direction : Vector2
var Diagonals : Array
func _init(dir : Vector2, diago:Array):
Direction = dir
Diagonals = diago
I make a list of directions, which I combine :
const DIRECTION = {
"N" :Vector2(0,1),
"S" :Vector2(0,-1),
"E" :Vector2(0,1), etc...
onready var WALL = {
"N" : Wall.new( DIRECTION["N"], [DIRECTION["N_E"], DIRECTION["N_O"]]),
"S" : Wall.new( DIRECTION["S"], [DIRECTION["S_E"], DIRECTION["S_O"]]), etc...
onready var WALLS_ON_EDGES = {
TYPE_WALLS.CORNER_N_O : [WALL["N"], WALL["O"]],
TYPE_WALLS.CORNER_N_E : [WALL["N"], WALL["E"]], etc...
enum TYPE_WALLS {CORNER_N_O, CORNER_N_E, CORNER_S_O, CORNER_S_E,
WALL_N, WALL_E, WALL_S, WALL_O,
NO_PASS, FREE_PASS
}
At each tilemap index, I give it the array contained in WALLS_ ON_ EDGES
func Add_connect_type(n:int, type_walls:int):
///... code
if WALLS_ON_EDGES.has(type_walls):
_cells_index_with_wall[n] = WALLS_ON_EDGES[type_walls]
Then, I select the index of a particular tile and store the array of that tile to do operations with :
func Create_all_Walls_on_edges():
var all_index_with_wall = _cells_index_with_wall.keys()
///... code
for idx in all_index_with_wall:
#array of all cells with idx
var cells_idx = get_used_cells_by_id (idx)
#Walls of idx
var ar_walls_of_idx = _cells_index_with_wall[idx]
print("ar_walls_of_idx : " + str(ar_walls_of_idx))
if ///...code
the ar_ walls _of _idx indicates: [[Reference:1261]]
Do you know how to interpret it?
Good Day,