summaryrefslogtreecommitdiff
path: root/stage/hud_main.gd
diff options
context:
space:
mode:
Diffstat (limited to 'stage/hud_main.gd')
-rw-r--r--stage/hud_main.gd39
1 files changed, 39 insertions, 0 deletions
diff --git a/stage/hud_main.gd b/stage/hud_main.gd
new file mode 100644
index 0000000..2aea87e
--- /dev/null
+++ b/stage/hud_main.gd
@@ -0,0 +1,39 @@
+extends CanvasLayer
+
+
+@onready var grid_selector: GridSelector = get_tree().get_first_node_in_group("grid_selector")
+
+
+func _ready() -> void:
+ visible = false
+
+
+func _input(event: InputEvent) -> void:
+ if not visible:
+ return
+
+ if event.is_action_pressed("left_click"):
+ for button: Button in $PanelContainer/VBoxContainer.get_children():
+ if button.has_focus():
+ button.pressed.emit()
+ break
+
+ if event.is_action_pressed("menu") or event.is_action_pressed("right_click"):
+ visible = false
+ grid_selector.process_mode = Node.PROCESS_MODE_INHERIT
+
+
+func _on_button_pressed() -> void:
+ visible = false
+
+ var dice_throw_scene = load("res://stage/dice_throw/dice_throw.tscn")
+ var dice_throw = dice_throw_scene.instantiate()
+ get_tree().root.add_child(dice_throw)
+ dice_throw.position -= dice_throw.size * 0.5
+ dice_throw.throw_finished.connect(func():
+ dice_throw.queue_free()
+ get_tree().current_scene.process_mode = PROCESS_MODE_INHERIT
+ grid_selector.process_mode = PROCESS_MODE_INHERIT
+ grid_selector.current_state = grid_selector.state_cube_placement
+ )
+ get_tree().current_scene.process_mode = PROCESS_MODE_DISABLED