summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Andrade de Almeida <vct.a.almeida@gmail.com>2022-07-16 22:25:51 -0300
committerVictor Andrade de Almeida <vct.a.almeida@gmail.com>2022-07-16 22:25:51 -0300
commit9eb8b91fe0abff8764c2d6c0a5edeceb68f5626e (patch)
treebcb21cbbce34b8111cc0eab04efe33894a2b687b
parente944fb258407ae952e85cb96f1faeddb1d3089e2 (diff)
downloadgamejam-gmtk-2022-9eb8b91fe0abff8764c2d6c0a5edeceb68f5626e.tar.gz
gamejam-gmtk-2022-9eb8b91fe0abff8764c2d6c0a5edeceb68f5626e.tar.bz2
gamejam-gmtk-2022-9eb8b91fe0abff8764c2d6c0a5edeceb68f5626e.zip
Add random room rotations
-rw-r--r--Scenes/Builder.gd22
1 files changed, 17 insertions, 5 deletions
diff --git a/Scenes/Builder.gd b/Scenes/Builder.gd
index 84e073a..f144104 100644
--- a/Scenes/Builder.gd
+++ b/Scenes/Builder.gd
@@ -170,17 +170,29 @@ func choose_divider() -> int:
return Divider.NONE
-func build_layout(corner : Vector2, crystals : int, current_stage : int, dungeon):
+func build_layout(corner : Vector2, crystals : int, current_stage : int, dungeon):
+ var phi = 0
+ match randi() % 4:
+ 1:
+ corner += Vector2(room_size - 1, 0)
+ phi = PI / 2
+ 2:
+ corner += Vector2(room_size - 1, room_size - 1)
+ phi = PI
+ 3:
+ corner += Vector2(0, room_size - 1)
+ phi = PI * 3 / 2
+
match choose_layout(current_stage):
Layout.EXAMPLE:
- return build_layout_example(corner, crystals, dungeon)
+ return build_layout_example(corner, phi, crystals, dungeon)
-func build_layout_example(corner : Vector2, crystals : int, dungeon):
+func build_layout_example(corner : Vector2, phi : float, crystals : int, dungeon):
if crystals >= 1:
- build_crystal(corner + Vector2(2, 2), corner + Vector2(2, 3), dungeon)
+ build_crystal(corner + Vector2(2, 2).rotated(phi), corner + Vector2(2, 3).rotated(phi), dungeon)
if crystals >= 2:
- build_crystal(corner + Vector2(4, 2), corner + Vector2(4, 3), dungeon)
+ build_crystal(corner + Vector2(4, 2).rotated(phi), corner + Vector2(4, 3).rotated(phi), dungeon)
return corner