Godot Version
4.2
Question
I have been trying to adjust my procedural generation code so that I can add navigation layers. Before, I was just deleting a bunch of tiles from a walker, where terrain set would then make it look good. However, now after deleting a tile, I am trying to place a tile with no physics layers but with navigation layer. However, for some reason, the wrong tile is placed, so I get a big block of wall tiles, not a mixture of wall and floor tile.
Code:
func generate_level():
var walker = Walker.new(Vector2(76, 41), borders)
var map = walker.walk(1000)
var player_position = map.front() * 16
set_player_spawn(player_position)
var spawner = Spawner.instantiate()
add_child(spawner)
spawner.position = walker.get_end_room().position * 16
walker.queue_free()
for location in map:
tileMap.erase_cell(0, location)
#var tilep = tileMap.local_to_map(location)
tileMap.set_cell(0, location, 0, Vector2i(0, 0))
var used_tiles = tileMap.get_used_cells(0)
for tile in used_tiles:
tileMap.erase_cell(0, tile)
tileMap.set_cell(0, tile, 0, Vector2i(0, 0))
tileMap.set_cells_terrain_connect(0, used_tiles, 0, 0)
The id of the tileset is 0, and the atlas coordinates are (0, 0) for the navigation/floor tile. What am I doing wrong?