summaryrefslogtreecommitdiffstats
path: root/pause_menu.gd
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-11-26 22:34:37 +0200
committerJan Tuomi <jan@jantuomi.fi>2025-11-26 22:34:37 +0200
commit0b0960c76c99e44632428cdeb116f5642181641a (patch)
tree2b99eedf159e9679b470f9c1b6a27b6db2f3998f /pause_menu.gd
parentadfd7c8a55112fa731b82417f27a18175c69e95e (diff)
Refactor Map to PauseMenu
Diffstat (limited to 'pause_menu.gd')
-rw-r--r--pause_menu.gd27
1 files changed, 27 insertions, 0 deletions
diff --git a/pause_menu.gd b/pause_menu.gd
new file mode 100644
index 0000000..e5a3129
--- /dev/null
+++ b/pause_menu.gd
@@ -0,0 +1,27 @@
+class_name PauseMenu
+extends CanvasLayer
+
+var active_map_room: MapRoom
+
+func _ready():
+ deactivate()
+
+func set_room_name(map_room_name: String):
+ if active_map_room: active_map_room.unhighlight()
+
+ active_map_room = $Map.get_node_or_null(map_room_name)
+
+ if active_map_room:
+ active_map_room.highlight()
+ var pos = active_map_room.position
+ var size = get_viewport().get_visible_rect().size
+ var delta = Vector2(size.x / 2, size.y / 2)
+ $Map.position = -pos + delta - active_map_room.size / 2
+
+func activate():
+ visible = true
+ get_tree().call_group("ui_movement", "set_visible", false)
+
+func deactivate():
+ visible = false
+ get_tree().call_group("ui_movement", "set_visible", true)