diff options
Diffstat (limited to 'scripts/bsp_level_generator.gd')
-rw-r--r-- | scripts/bsp_level_generator.gd | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/bsp_level_generator.gd b/scripts/bsp_level_generator.gd index 57778d4..f4191a3 100644 --- a/scripts/bsp_level_generator.gd +++ b/scripts/bsp_level_generator.gd @@ -74,11 +74,11 @@ func check_door(grid: Array[Tile.Tile], axis: int, door_pos: Vector2i) -> bool: var room_right = door_pos room_right[axis] += 1 - if door_pos.x > grid_width or door_pos.y > grid_height: + if door_pos.x >= grid_width or door_pos.y >= grid_height: return false - if room_left.x > grid_width or room_left.y > grid_height: + if room_left.x >= grid_width or room_left.y >= grid_height: return false - if room_right.x > grid_width or room_right.y > grid_height: + if room_right.x >= grid_width or room_right.y >= grid_height: return false # Check if there are two spaces to connect @@ -106,9 +106,9 @@ func generate_grid(map: BSPNode, grid: Array[Tile.Tile]) -> void: var test_door = randi_range(map.min_dims[other_axis], map.max_dims[other_axis] - 1) var door_pos = Vector2i.ZERO door_pos[map.axis] = split_axis - door_pos[other_axis] = test_door + 1 + door_pos[other_axis] = test_door + 2 var door_pos2 = door_pos - door_pos[other_axis] += 1 + door_pos2[other_axis] += 1 if check_door(grid, map.axis, door_pos) and check_door(grid, map.axis, door_pos2): have_door = true |