diff options
author | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2024-09-26 15:59:53 +0100 |
---|---|---|
committer | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2024-09-26 16:02:29 +0100 |
commit | 0127a8ec6c66a9abaeb97f0b02b70d5d91a835cc (patch) | |
tree | 949f345bedd25d7cfcad421e964e32cff6368639 /scripts/bsp_level_generator.gd | |
parent | d29a892d287b52beb48c331c0da7bc59ac3db237 (diff) |
bsp_level_generator: Add special door tile
Having a specific door tile will prevent overlapping doors from
generating as the check for a floor next to the door will fail.
Diffstat (limited to 'scripts/bsp_level_generator.gd')
-rw-r--r-- | scripts/bsp_level_generator.gd | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/scripts/bsp_level_generator.gd b/scripts/bsp_level_generator.gd index 4a1ca9b..664b7a5 100644 --- a/scripts/bsp_level_generator.gd +++ b/scripts/bsp_level_generator.gd @@ -111,8 +111,8 @@ func generate_grid(map: BSPNode, grid: Array[Tile.Tile]) -> void: have_door = true # Place grid for mesh - grid[door_pos.y * grid_width + door_pos.x] = Tile.Tile.FLOOR - grid[door_pos2.y * grid_width + door_pos2.x] = Tile.Tile.FLOOR + grid[door_pos.y * grid_width + door_pos.x] = Tile.Tile.DOOR + grid[door_pos2.y * grid_width + door_pos2.x] = Tile.Tile.DOOR #door_pos[map.axis] -= 1 #grid[door_pos.y * grid_width + door_pos.x] = Tile.Tile.FLOOR @@ -146,14 +146,13 @@ func generate_geo(grid: Array[Tile.Tile], array: Array) -> void: for x in range(grid_width): var tile = grid[y * grid_width + x] - if tile == Tile.Tile.FLOOR: + if tile == Tile.Tile.FLOOR or tile == Tile.Tile.DOOR: generate_plane(array, Vector3(x, 0, y), [Vector3(1, 0, 0), Vector3(0, 0, 1)], Vector3.UP) elif tile == Tile.Tile.WALL: - generate_plane(array, Vector3(x, 2, y), [Vector3(0, 0, 1), Vector3(0, -2, 0)], Vector3.RIGHT) + generate_plane(array, Vector3(x, 2, y), [Vector3(0, 0, 1), Vector3(0, -2, 0)], Vector3.LEFT) generate_plane(array, Vector3(x, 2, y+1), [Vector3(1, 0, 0), Vector3(0, -2, 0)], Vector3.BACK) - generate_plane(array, Vector3(x+1, 2, y+1), [Vector3(0, 0, -1), Vector3(0, -2, 0)], Vector3.LEFT) + generate_plane(array, Vector3(x+1, 2, y+1), [Vector3(0, 0, -1), Vector3(0, -2, 0)], Vector3.RIGHT) generate_plane(array, Vector3(x+1, 2, y), [Vector3(-1, 0, 0), Vector3(0, -2, 0)], Vector3.FORWARD) - pass func _ready() -> void: var starting_axis = randi_range(0, 1) |