From 5e62cca19ee202353d9ad17c9ee0cfe96671864b Mon Sep 17 00:00:00 2001 From: Lucas Fryzek Date: Thu, 26 Sep 2024 22:45:36 +0100 Subject: dungeon_manager: Create 3D portal model with texture --- scripts/dungeon_manager.gd | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/dungeon_manager.gd b/scripts/dungeon_manager.gd index 12b80fa..39b6131 100644 --- a/scripts/dungeon_manager.gd +++ b/scripts/dungeon_manager.gd @@ -45,8 +45,16 @@ func create_exit() -> void: exit.connect("body_entered", _on_player_exit) while not found_pos: var pos = Vector2i(randi_range(0, grid_width-1), randi_range(0, grid_height-1)) + var left = pos + Vector2i.LEFT + var right = pos + Vector2i.RIGHT + var up = pos + Vector2i.UP + var down = pos + Vector2i.DOWN - if grid[pos.y * grid_width + pos.x] == Tile.Tile.FLOOR: + if grid[pos.y * grid_width + pos.x] == Tile.Tile.FLOOR \ + and grid[left.y * grid_width + left.x] == Tile.Tile.FLOOR \ + and grid[right.y * grid_width + right.x] == Tile.Tile.FLOOR \ + and grid[up.y * grid_width + up.x] == Tile.Tile.FLOOR \ + and grid[down.y * grid_width + down.x] == Tile.Tile.FLOOR: exit.position = Vector3(pos.x, 0, pos.y) + Vector3(0.5, 0, 0.5) found_pos = true -- cgit