diff options
author | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2024-09-26 22:45:36 +0100 |
---|---|---|
committer | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2024-09-26 22:45:36 +0100 |
commit | 5e62cca19ee202353d9ad17c9ee0cfe96671864b (patch) | |
tree | 13a147df96eed2955683ab2ba1b8883ce792f665 /scripts/dungeon_manager.gd | |
parent | f87b54a8a1cb8dba0c8fd85f9e00665a85bdace3 (diff) |
dungeon_manager: Create 3D portal model with texture
Diffstat (limited to 'scripts/dungeon_manager.gd')
-rw-r--r-- | scripts/dungeon_manager.gd | 10 |
1 files changed, 9 insertions, 1 deletions
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 |