diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/bsp_level_generator.gd | 11 | ||||
-rw-r--r-- | scripts/tile.gd | 2 |
2 files changed, 6 insertions, 7 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) diff --git a/scripts/tile.gd b/scripts/tile.gd index 6243b9c..87bc2a3 100644 --- a/scripts/tile.gd +++ b/scripts/tile.gd @@ -1,3 +1,3 @@ extends Node -enum Tile {FLOOR, WALL} +enum Tile {FLOOR, WALL, DOOR} |