Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | pieceoftheuniverse |
Trying to get autotiling to work with procedural generation.
The code I have to create walls, and then dig out a path:
func generate_level():
# Fil map with walls
for x in range(0, map_width + 2):
for y in range(0, map_height + 2):
map_walls.set_cell(x,y, 0)
# Maze function for most floors
# Walker function for warrens
var walker = Walker.new(Vector2((map_width/2), (map_height/2)), borders)
var map = walker.walk(1000)
walker.queue_free()
for location in map:
map_floors.set_cellv(location, _pick_random_texture(Cell.WARREN))
map_walls.update_bitmask_area(location)
map_walls.update_bitmask_region()
What happens:
What I expect:
I’ve triple-checked the bitmask for the autotile, and it always works if I hand-draw the levels. But when generating the levels, the autotile just won’t update the bitmask.
If I try to update the bitmask area instead of the region, I get: