From 03080afab1ace191d0fda29845b033887e6e49f3 Mon Sep 17 00:00:00 2001 From: Lucas Fryzek Date: Mon, 23 Sep 2024 19:35:54 +0100 Subject: bsp_level_generator: Fix walls generating past the end of the room enemy: Fix seeing through walls --- scripts/bsp_level_generator.gd | 5 +---- scripts/enemy.gd | 6 +----- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/scripts/bsp_level_generator.gd b/scripts/bsp_level_generator.gd index f4191a3..bef90be 100644 --- a/scripts/bsp_level_generator.gd +++ b/scripts/bsp_level_generator.gd @@ -65,9 +65,6 @@ func is_leaf(node: BSPNode) -> bool: return node.left == null and node.right == null func check_door(grid: Array[Tile.Tile], axis: int, door_pos: Vector2i) -> bool: - var other_axis = (axis + 1) % 2 - door_pos[other_axis] += 1 - var room_left = door_pos room_left[axis] -= 1 @@ -106,7 +103,7 @@ 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 + 2 + door_pos[other_axis] = test_door + 1 var door_pos2 = door_pos door_pos2[other_axis] += 1 diff --git a/scripts/enemy.gd b/scripts/enemy.gd index 871145b..8c5652f 100644 --- a/scripts/enemy.gd +++ b/scripts/enemy.gd @@ -80,13 +80,9 @@ func check_target_visible() -> bool: var space_state = get_world_3d().direct_space_state var starting_pos = global_position var ending_pos = target.global_position + Vector3.UP - var query = PhysicsRayQueryParameters3D.create(starting_pos, ending_pos, 0x3, [self.get_rid()]) + var query = PhysicsRayQueryParameters3D.create(starting_pos, ending_pos, 0xFFFFFFFF, [self.get_rid()]) var result = space_state.intersect_ray(query) - print("Checking player") - if result: - print("Hit ", result.collider, " Target ", target, " Self ", self) - if result and result.collider == target: return true -- cgit