Add HP/VT bars

This commit is contained in:
2025-08-08 23:16:51 -07:00
parent 7c694149c2
commit bd6794dafd
6 changed files with 75 additions and 16 deletions

View File

@@ -1,8 +0,0 @@
{
"sdk": {
"version": "8.0.400"
},
"msbuild-sdks": {
"Godot.NET.Sdk": "4.4.0"
}
}

View File

@@ -2,9 +2,9 @@
state "EnemyLogic State" as Zennysoft_Game_Ma_EnemyLogic_State { state "EnemyLogic State" as Zennysoft_Game_Ma_EnemyLogic_State {
state "Alive" as Zennysoft_Game_Ma_EnemyLogic_State_Alive { state "Alive" as Zennysoft_Game_Ma_EnemyLogic_State_Alive {
state "Activated" as Zennysoft_Game_Ma_EnemyLogic_State_Activated { state "Activated" as Zennysoft_Game_Ma_EnemyLogic_State_Activated {
state "Patrolling" as Zennysoft_Game_Ma_EnemyLogic_State_Patrolling
state "Attacking" as Zennysoft_Game_Ma_EnemyLogic_State_Attacking state "Attacking" as Zennysoft_Game_Ma_EnemyLogic_State_Attacking
state "FollowPlayer" as Zennysoft_Game_Ma_EnemyLogic_State_FollowPlayer state "FollowPlayer" as Zennysoft_Game_Ma_EnemyLogic_State_FollowPlayer
state "Patrolling" as Zennysoft_Game_Ma_EnemyLogic_State_Patrolling
} }
state "Idle" as Zennysoft_Game_Ma_EnemyLogic_State_Idle state "Idle" as Zennysoft_Game_Ma_EnemyLogic_State_Idle
} }

View File

@@ -5,4 +5,4 @@ transparency = 1
depth_draw_mode = 1 depth_draw_mode = 1
shading_mode = 0 shading_mode = 0
vertex_color_use_as_albedo = true vertex_color_use_as_albedo = true
albedo_color = Color(1, 1, 1, 0.482353) albedo_color = Color(0.929412, 0.454902, 0.117647, 0.843137)

View File

@@ -571,6 +571,7 @@ axis = 1
texture = ExtResource("7_8hi2n") texture = ExtResource("7_8hi2n")
[node name="Collision" type="Node3D" parent="."] [node name="Collision" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.301443, 0)
[node name="Hitbox" type="Area3D" parent="Collision"] [node name="Hitbox" type="Area3D" parent="Collision"]
unique_name_in_owner = true unique_name_in_owner = true

View File

@@ -24,6 +24,13 @@ public partial class PlayerInfoUI : Control, IPlayerInfoUI
[Node] public Label HPNumber { get; set; } = default!; [Node] public Label HPNumber { get; set; } = default!;
[Node] public Label VTNumber { get; set; } = default!; [Node] public Label VTNumber { get; set; } = default!;
[Node] public Label EXPNumber { get; set; } = default!;
[Node] public ProgressBar HPProgressBar { get; set; } = default!;
[Node] public ProgressBar VTProgressBar { get; set; } = default!;
#endregion #endregion
[Dependency] public IPlayer Player => this.DependOn<IPlayer>(); [Dependency] public IPlayer Player => this.DependOn<IPlayer>();
@@ -37,30 +44,45 @@ public partial class PlayerInfoUI : Control, IPlayerInfoUI
Player.Stats.MaximumVT.Sync += MaximumVT_Sync; Player.Stats.MaximumVT.Sync += MaximumVT_Sync;
Player.Stats.CurrentLevel.Sync += CurrentLevel_Sync; Player.Stats.CurrentLevel.Sync += CurrentLevel_Sync;
Player.Stats.CurrentExp.Sync += CurrentExp_Sync;
Player.Stats.ExpToNextLevel.Sync += ExpToNextLevel_Sync;
} }
private void CurrentLevel_Sync(int obj) private void CurrentLevel_Sync(int obj)
{ {
LevelNumber.Text = $"{obj}"; LevelNumber.Text = $"LVL. {obj}";
} }
private void MaximumVT_Sync(int obj) private void MaximumVT_Sync(int obj)
{ {
VTNumber.Text = $"{Player.Stats.CurrentVT.Value}/{obj}"; VTNumber.Text = $"{Player.Stats.CurrentVT.Value}/{obj}";
VTProgressBar.MaxValue = obj;
} }
private void CurrentVT_Sync(int obj) private void CurrentVT_Sync(int obj)
{ {
VTNumber.Text = $"{obj}/{Player.Stats.MaximumVT.Value}"; VTNumber.Text = $"{obj}/{Player.Stats.MaximumVT.Value}";
VTProgressBar.Value = obj;
} }
private void MaximumHP_Sync(int obj) private void MaximumHP_Sync(int obj)
{ {
HPNumber.Text = $"{Player.Stats.CurrentHP.Value}/{obj}"; HPNumber.Text = $"{Player.Stats.CurrentHP.Value}/{obj}";
HPProgressBar.MaxValue = obj;
} }
private void CurrentHP_Sync(int obj) private void CurrentHP_Sync(int obj)
{ {
HPNumber.Text = $"{obj}/{Player.Stats.MaximumHP.Value}"; HPNumber.Text = $"{obj}/{Player.Stats.MaximumHP.Value}";
HPProgressBar.Value = obj;
}
private void CurrentExp_Sync(double obj)
{
EXPNumber.Text = $"XP {(int)obj}/{Player.Stats.ExpToNextLevel.Value}";
}
private void ExpToNextLevel_Sync(int obj)
{
EXPNumber.Text = $"XP {Player.Stats.CurrentExp.Value}/{obj}";
} }
} }

View File

@@ -1,9 +1,31 @@
[gd_scene load_steps=4 format=3 uid="uid://dxl8il8f13c2x"] [gd_scene load_steps=8 format=3 uid="uid://dxl8il8f13c2x"]
[ext_resource type="Script" uid="uid://b65cbirtijlii" path="res://src/ui/player_ui/PlayerInfoUI.cs" id="1_d8yyu"] [ext_resource type="Script" uid="uid://b65cbirtijlii" path="res://src/ui/player_ui/PlayerInfoUI.cs" id="1_d8yyu"]
[ext_resource type="LabelSettings" uid="uid://ca1q6yu8blwxf" path="res://src/ui/label_settings/InventoryMainTextBold.tres" id="2_aa7fx"] [ext_resource type="LabelSettings" uid="uid://ca1q6yu8blwxf" path="res://src/ui/label_settings/InventoryMainTextBold.tres" id="2_aa7fx"]
[ext_resource type="LabelSettings" uid="uid://dupifadnagodp" path="res://src/ui/label_settings/MainTextRegular.tres" id="3_xdjh1"] [ext_resource type="LabelSettings" uid="uid://dupifadnagodp" path="res://src/ui/label_settings/MainTextRegular.tres" id="3_xdjh1"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bqtin"]
bg_color = Color(0.00392157, 0.341176, 0.141176, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_hkw8m"]
bg_color = Color(0.207843, 1, 0.52549, 1)
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
border_color = Color(0.00392157, 0.341176, 0.141176, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_nv5jb"]
bg_color = Color(0.0980392, 0.129412, 0.270588, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gio7f"]
bg_color = Color(0.223529, 0.368627, 0.996078, 1)
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
border_color = Color(0.0980392, 0.129412, 0.270588, 1)
[node name="PlayerInfoUI" type="Control"] [node name="PlayerInfoUI" type="Control"]
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
@@ -51,9 +73,21 @@ border_width = 0.0
[node name="HPNumber" type="Label" parent="AspectRatio/PlayerInfo/HBoxContainer/VBox/HP Box"] [node name="HPNumber" type="Label" parent="AspectRatio/PlayerInfo/HBoxContainer/VBox/HP Box"]
unique_name_in_owner = true unique_name_in_owner = true
custom_minimum_size = Vector2(160, 0)
layout_mode = 2 layout_mode = 2
text = "222/222" text = "222/222"
label_settings = ExtResource("3_xdjh1") label_settings = ExtResource("3_xdjh1")
horizontal_alignment = 2
[node name="HPProgressBar" type="ProgressBar" parent="AspectRatio/PlayerInfo/HBoxContainer/VBox/HP Box"]
unique_name_in_owner = true
custom_minimum_size = Vector2(150, 12)
layout_mode = 2
size_flags_vertical = 4
theme_override_styles/background = SubResource("StyleBoxFlat_bqtin")
theme_override_styles/fill = SubResource("StyleBoxFlat_hkw8m")
value = 50.0
show_percentage = false
[node name="VT Box" type="HBoxContainer" parent="AspectRatio/PlayerInfo/HBoxContainer/VBox"] [node name="VT Box" type="HBoxContainer" parent="AspectRatio/PlayerInfo/HBoxContainer/VBox"]
layout_mode = 2 layout_mode = 2
@@ -70,9 +104,21 @@ border_width = 0.0
[node name="VTNumber" type="Label" parent="AspectRatio/PlayerInfo/HBoxContainer/VBox/VT Box"] [node name="VTNumber" type="Label" parent="AspectRatio/PlayerInfo/HBoxContainer/VBox/VT Box"]
unique_name_in_owner = true unique_name_in_owner = true
custom_minimum_size = Vector2(160, 0)
layout_mode = 2 layout_mode = 2
text = "444/444" text = "444/444"
label_settings = ExtResource("3_xdjh1") label_settings = ExtResource("3_xdjh1")
horizontal_alignment = 2
[node name="VTProgressBar" type="ProgressBar" parent="AspectRatio/PlayerInfo/HBoxContainer/VBox/VT Box"]
unique_name_in_owner = true
custom_minimum_size = Vector2(150, 12)
layout_mode = 2
size_flags_vertical = 4
theme_override_styles/background = SubResource("StyleBoxFlat_nv5jb")
theme_override_styles/fill = SubResource("StyleBoxFlat_gio7f")
value = 50.0
show_percentage = false
[node name="Level Box" type="HBoxContainer" parent="AspectRatio/PlayerInfo/HBoxContainer/VBox"] [node name="Level Box" type="HBoxContainer" parent="AspectRatio/PlayerInfo/HBoxContainer/VBox"]
layout_mode = 2 layout_mode = 2
@@ -82,8 +128,7 @@ unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
text = "LVL. 08" text = "LVL. 08"
label_settings = ExtResource("2_aa7fx") label_settings = ExtResource("2_aa7fx")
horizontal_alignment = 1 horizontal_alignment = 2
vertical_alignment = 1
[node name="EXP Box" type="HBoxContainer" parent="AspectRatio/PlayerInfo/HBoxContainer/VBox"] [node name="EXP Box" type="HBoxContainer" parent="AspectRatio/PlayerInfo/HBoxContainer/VBox"]
layout_mode = 2 layout_mode = 2
@@ -93,5 +138,4 @@ unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
text = "XP 901/2002" text = "XP 901/2002"
label_settings = ExtResource("2_aa7fx") label_settings = ExtResource("2_aa7fx")
horizontal_alignment = 1 horizontal_alignment = 2
vertical_alignment = 1