From 218748f67a6a6b35efc4a732ad11426d0f528709 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Wed, 12 Feb 2025 20:05:59 +0100 Subject: next commit --- stage/hud_main.gd | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'stage/hud_main.gd') 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 -- cgit v1.2.3