From 5d410a02fb45e1e47b9645a7f8d6b75a17a1f4a4 Mon Sep 17 00:00:00 2001 From: 2ManyProjects Date: Sat, 1 Feb 2025 16:26:32 -0600 Subject: [PATCH] state display --- Systems/Game/ChessGame.gd | 2 +- Systems/StateMachine/StateMachine.gd | 2 ++ board.tscn | 38 ++++++++++++++++++---------- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/Systems/Game/ChessGame.gd b/Systems/Game/ChessGame.gd index adfa36d..3d829ff 100644 --- a/Systems/Game/ChessGame.gd +++ b/Systems/Game/ChessGame.gd @@ -23,7 +23,7 @@ var p2Points: int = 0 var Turn: int = 0 @onready var turnIndicator: ColorRect = $TurnIndicator @onready var p1String: RichTextLabel = $Player1Points -@onready var p2String: RichTextLabel = $Player2Points +@onready var p2String: RichTextLabel = $Player2Points @onready var deckManager: DeckManager @onready var cardDisplay: CardDisplay @onready var cardPreview: CardPreview diff --git a/Systems/StateMachine/StateMachine.gd b/Systems/StateMachine/StateMachine.gd index 8d87250..849fc23 100644 --- a/Systems/StateMachine/StateMachine.gd +++ b/Systems/StateMachine/StateMachine.gd @@ -8,6 +8,7 @@ class_name StateMachine extends Node @onready var parent = get_parent() var previouseState = null +@onready var stateString: RichTextLabel = owner.get_node("StateLabel") func _ready() -> void: @@ -37,4 +38,5 @@ func transitionToNextState(targetStatePath: String, data: Dictionary = {}) -> vo previouseState = state.name state.exit() state = get_node(targetStatePath) + stateString.text = targetStatePath; state.enter(previouseState, data) diff --git a/board.tscn b/board.tscn index d972218..2655b94 100644 --- a/board.tscn +++ b/board.tscn @@ -22,6 +22,8 @@ layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 +offset_right = -104.0 +offset_bottom = -5.0 grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_fkb2r") @@ -40,9 +42,10 @@ layout_mode = 1 anchors_preset = 1 anchor_left = 1.0 anchor_right = 1.0 -offset_left = -50.0 -offset_top = 50.0 -offset_bottom = 89.0 +offset_left = 51.0 +offset_top = 48.0 +offset_right = 101.0 +offset_bottom = 87.0 grow_horizontal = 0 [node name="Player2Points" type="RichTextLabel" parent="."] @@ -50,9 +53,10 @@ layout_mode = 1 anchors_preset = 1 anchor_left = 1.0 anchor_right = 1.0 -offset_left = -48.0 -offset_top = 100.0 -offset_bottom = 140.0 +offset_left = 54.0 +offset_top = 96.0 +offset_right = 102.0 +offset_bottom = 136.0 grow_horizontal = 0 [node name="TurnIndicator" type="ColorRect" parent="."] @@ -61,16 +65,22 @@ layout_mode = 1 anchors_preset = 1 anchor_left = 1.0 anchor_right = 1.0 -offset_left = -50.0 -offset_bottom = 50.0 +offset_left = 52.0 +offset_top = -2.0 +offset_right = 102.0 +offset_bottom = 48.0 grow_horizontal = 0 -[node name="RichTextLabel" type="RichTextLabel" parent="."] -layout_mode = 0 -offset_left = 1062.0 -offset_top = 65.0 -offset_right = 1142.0 -offset_bottom = 104.0 +[node name="StateLabel" type="RichTextLabel" parent="."] +layout_mode = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -78.0 +offset_top = 1.0 +offset_right = 51.0 +offset_bottom = 40.0 +grow_horizontal = 0 [node name="Hand" type="HBoxContainer" parent="."] layout_mode = 1