I dont see the problem if anyone could help that would be great, please and thank you.

``````func build_level():

rooms.clear()
map.clear()
tile_map.clear()

level_size = LEVEL_SIZES[level_num]
for x in range(level_size.x):
map.append([])
for y in range(level_size.y):
map[x].append([Tile.Stone])
tile_map.set_cell(x, y, Tile.Stone)

var free_regions = [Rect2(Vector2(2, 2), level_size - Vector2(4, 4))]
var num_rooms = LEVEL_ROOM_COUNTS[level_num]
for i in range(num_rooms):
if free_regions.empty():
break

connect_rooms()
``````

Here are is the second Function where the problem keeps saying it is

``````func connect_rooms():
# Build an AStar graph of the area where we can add corridors

var stone_graph = AStar.new()
var point_id = 0
for x in range(level_size.x):
for y in range(level_size.y):
if map[x][y] == Tile.Stone:

# Connect to the Left if also Stone
if x > 0 && map[x - 1][y] == Tile.Stone:
var left_point = stone_graph.get_closest_point(Vector3(x - 1, y, 0))
stone_graph.connect_points(point_id, left_point)

# Connect to the Above if also Stone
if y > 0 && map[x][y - 1] == Tile.Stone:
var above_point = stone_graph.get_closest_point(Vector3(x, y - 1, 0))
stone_graph.connect_points(point_id, above_point)

point_id += 1

# Build an AStar graph of room connection

var room_graph = AStar.new()
point_id = 0
for room in rooms:
var room_center = room.position + room.size / 2
point_id += 1

# Add random connections until everything is connected

while !is_everything_connected(room_graph):
``````
in Engine
retagged

Problem is in `build_level()`:

``````func build_level():

rooms.clear()
map.clear()
``````

`map` now contains `[]`

``````    tile_map.clear()

level_size = LEVEL_SIZES[level_num]
for x in range(level_size.x):
map.append([])
``````

`map` now contains `[[]]`

``````        for y in range(level_size.y):
map[x].append([Tile.Stone])
``````

`map` now contains `[[[Tile.Stone]]]`...
...and this is a 3D array. Notice the 3 brackets!
So if you access `map[x][y]`, you get an array, hence your error when you expected an integer.

The fix:

``````            map[x].append(Tile.Stone)
``````
by (29,036 points)
selected

Where Does that line of code go?

``````for x in range(level_size.x):
map.append([])
for y in range(level_size.y):
map[x].append(Tile.Stone) # <---- Here
tile_map.set_cell(x, y, Tile.Stone)
``````

Thank you so much!! It now works and everything is fixed. I really apperate the help and it means a lot to me that you could help me!!