summaryrefslogtreecommitdiff
path: root/stage/hud_main.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2025-02-12 20:05:59 +0100
committerDaniel Weipert <git@mail.dweipert.de>2025-02-12 20:05:59 +0100
commit218748f67a6a6b35efc4a732ad11426d0f528709 (patch)
treee58504dd758ce6525844872007221cda2a8b6926 /stage/hud_main.gd
parentf6c81b065cf4d7f1302a50f2f72cfab32204a1ec (diff)
next commitHEADmain
Diffstat (limited to 'stage/hud_main.gd')
-rw-r--r--stage/hud_main.gd38
1 files changed, 36 insertions, 2 deletions
diff --git a/stage/hud_main.gd b/stage/hud_main.gd
index b80b514..c736e34 100644
--- a/stage/hud_main.gd
+++ b/stage/hud_main.gd
@@ -6,6 +6,10 @@ extends CanvasLayer
func _ready() -> void:
visible = false
+
+ Network.current_player_changed.connect(func():
+ set_current_player()
+ )
func _input(event: InputEvent) -> void:
@@ -23,13 +27,43 @@ func _input(event: InputEvent) -> void:
grid_selector.process_mode = Node.PROCESS_MODE_INHERIT
+func set_current_player() -> void:
+ if Network.is_my_turn():
+ $PanelContainer3/CurrentTurn.text = "Current Turn: Me"
+ else:
+ $PanelContainer3/CurrentTurn.text = "Current Turn: " + str(Network.current_player.id)
+
+
+func enable():
+ $PanelContainer2/VBoxContainer/move.text = "Move: " + str(Network.local_player.current_move_points)
+ $PanelContainer2/VBoxContainer/attack.text = "Atk: " + str(Network.local_player.current_attack_points)
+ $PanelContainer2/VBoxContainer/defend.text = "Def: " + str(Network.local_player.current_defend_points)
+ $PanelContainer2/VBoxContainer/ability.text = "Ablty: " + str(Network.local_player.current_ability_points)
+
+ set_current_player()
+
+ if Network.is_my_turn():
+ $PanelContainer/VBoxContainer/Button.visible = true
+ $PanelContainer/VBoxContainer/Button2.visible = true
+ else:
+ $PanelContainer/VBoxContainer/Button.visible = false
+ $PanelContainer/VBoxContainer/Button2.visible = false
+
+ visible = true
+
+ $PanelContainer/VBoxContainer/Button.grab_focus()
+
+
func _on_button_pressed() -> void:
visible = false
+ # TODO: open dice selection screen
+ # TODO: => then open throw
+
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
+ Game.overlay.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