Now About Social Code
summaryrefslogtreecommitdiff
path: root/scripts/bsp_level_generator.gd
diff options
context:
space:
mode:
authorLucas Fryzek <lucas.fryzek@fryzekconcepts.com>2024-09-23 19:24:56 +0100
committerLucas Fryzek <lucas.fryzek@fryzekconcepts.com>2024-09-23 19:25:46 +0100
commitb262d5d194036571d0b3adad3c9914ba9dbe0c8b (patch)
tree8b2c97809f05450fa7624c811065f0cb6993b2a6 /scripts/bsp_level_generator.gd
parentb62062c72a2354ba06b53706d94d3db53c224f12 (diff)
enemy: Add line of sight to AI to look for player
Diffstat (limited to 'scripts/bsp_level_generator.gd')
-rw-r--r--scripts/bsp_level_generator.gd10
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