diff --git a/src/scenes/characters/player.tscn b/src/scenes/characters/player.tscn index 25d18b6..1f5edf6 100644 --- a/src/scenes/characters/player.tscn +++ b/src/scenes/characters/player.tscn @@ -48,53 +48,53 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0) [node name="Rig" parent="RigPivot" instance=ExtResource("3_n52bt")] [node name="Skeleton3D" parent="RigPivot/Rig/CharacterRig/GameRig" index="0"] -bones/0/position = Vector3(1.10278e-14, 0.894503, -0.0481735) +bones/0/position = Vector3(4.44089e-15, 0.91011, -0.0481736) bones/0/rotation = Quaternion(0.12582, 1.18262e-07, 1.49989e-08, 0.992053) bones/1/rotation = Quaternion(-0.0566577, -0.00072973, -0.0117082, 0.998325) bones/2/position = Vector3(3.20474e-09, 0.146689, -1.95578e-08) -bones/2/rotation = Quaternion(-0.0035143, -0.000443189, 0.00321533, 0.999989) +bones/2/rotation = Quaternion(0.00655903, -0.000279925, 0.00321131, 0.999973) bones/3/position = Vector3(-2.01263e-09, 0.202058, -2.51457e-08) -bones/3/rotation = Quaternion(-0.0979643, -0.000399219, 0.00851909, 0.995153) +bones/3/rotation = Quaternion(-0.0889245, -0.000281655, 0.0085246, 0.996002) bones/4/position = Vector3(3.02934e-10, 0.0925562, 3.91155e-08) -bones/4/rotation = Quaternion(0.278201, 1.45752e-08, 9.45482e-08, 0.960523) +bones/4/rotation = Quaternion(0.270158, 1.44168e-08, 9.17367e-08, 0.962816) bones/5/rotation = Quaternion(-0.0948564, -2.80691e-14, -2.26155e-08, 0.995491) -bones/6/rotation = Quaternion(-0.154381, -1.17377e-07, -2.09848e-08, 0.988011) -bones/7/position = Vector3(-3.12401e-08, 0.894502, -0.0481735) +bones/6/rotation = Quaternion(-0.164849, -1.17578e-07, -1.96515e-08, 0.986319) +bones/7/position = Vector3(-2.90528e-08, 0.910109, -0.0481735) bones/7/rotation = Quaternion(-0.0863677, -0.751104, -0.383052, 0.530711) -bones/8/position = Vector3(-6.05844e-08, 0.894502, -0.0481735) +bones/8/position = Vector3(-7.51225e-08, 0.910109, -0.0481735) bones/8/rotation = Quaternion(-0.0863677, 0.751104, 0.383052, 0.530711) -bones/9/position = Vector3(0.131144, 0.960707, -0.0351291) -bones/9/rotation = Quaternion(0.992736, 0.0210142, -0.0308827, 0.114366) +bones/9/position = Vector3(0.131144, 0.976314, -0.0351291) +bones/9/rotation = Quaternion(0.994252, 0.0202453, -0.0312494, 0.100386) bones/10/position = Vector3(-2.36129e-08, 0.26601, -2.14789e-08) bones/10/rotation = Quaternion(-3.13921e-08, -0.000695086, 1.20449e-08, 1) bones/11/position = Vector3(-4.6306e-08, 0.26601, 2.42145e-08) -bones/11/rotation = Quaternion(0.426635, -0.000700668, 0.000330655, 0.904424) +bones/11/rotation = Quaternion(0.394909, -0.000695073, 0.000298897, 0.91872) bones/12/position = Vector3(3.05151e-08, 0.22603, 5.03768e-08) bones/12/rotation = Quaternion(-8.19226e-09, -0.00710644, 4.16102e-08, 0.999975) bones/13/position = Vector3(-2.95495e-08, 0.22603, 2.68392e-09) -bones/13/rotation = Quaternion(-0.754363, 0.0118957, 0.0244191, 0.655896) +bones/13/rotation = Quaternion(-0.740733, 0.0118454, 0.0243604, 0.671253) bones/14/position = Vector3(-3.05481e-08, 0.139877, 1.64787e-08) bones/14/rotation = Quaternion(-9.66743e-05, 0.967474, -0.252972, -0.000383447) -bones/15/position = Vector3(-0.131144, 0.960707, -0.0351291) -bones/15/rotation = Quaternion(0.97251, -0.00591078, 0.0272326, 0.23119) +bones/15/position = Vector3(-0.131144, 0.976314, -0.0351291) +bones/15/rotation = Quaternion(0.975809, -0.00527957, 0.0276708, 0.216803) bones/16/position = Vector3(-1.10042e-08, 0.265705, -3.31989e-08) bones/16/rotation = Quaternion(-3.43227e-08, 0.00314323, 8.33075e-10, 0.999995) bones/17/position = Vector3(1.83545e-08, 0.265705, 6.98543e-10) -bones/17/rotation = Quaternion(0.450281, 0.00332722, -0.00167803, 0.892879) +bones/17/rotation = Quaternion(0.421119, 0.00315472, -0.00146481, 0.906999) bones/18/position = Vector3(1.2807e-08, 0.225719, -8.28774e-09) bones/18/rotation = Quaternion(-2.29017e-08, -0.00785732, 3.30149e-08, 0.999969) bones/19/position = Vector3(-1.27748e-08, 0.225719, 1.12004e-08) -bones/19/rotation = Quaternion(-0.690793, -0.0282064, -0.000547657, 0.722502) +bones/19/rotation = Quaternion(-0.678119, -0.0281383, -0.00144805, 0.734412) bones/20/position = Vector3(-1.30142e-08, 0.139877, -2.77457e-09) bones/20/rotation = Quaternion(-9.96472e-05, 0.967461, -0.253021, -0.000383039) -bones/21/position = Vector3(0.0251286, 1.42485, 0.0415178) -bones/21/rotation = Quaternion(-0.49711, -0.256398, -0.397268, 0.727544) -bones/22/position = Vector3(0.187962, 1.46126, -0.0263026) -bones/22/rotation = Quaternion(0.0548836, -0.158917, 0.974172, -0.150742) +bones/21/position = Vector3(0.0251286, 1.4397, 0.0471616) +bones/21/rotation = Quaternion(-0.47066, -0.267182, -0.416639, 0.730414) +bones/22/position = Vector3(0.191425, 1.47852, -0.0100938) +bones/22/rotation = Quaternion(0.0214745, -0.163989, 0.97548, -0.145209) bones/23/position = Vector3(-5.41331e-09, 0.143946, -2.98023e-08) -bones/23/rotation = Quaternion(1.2041e-07, -0.011847, -3.39987e-08, 0.99993) +bones/23/rotation = Quaternion(8.73158e-08, -0.0389223, -1.72377e-09, 0.999242) bones/24/position = Vector3(-6.33301e-08, 0.143946, 4.3873e-08) -bones/24/rotation = Quaternion(0.289579, -0.0118476, -0.0175549, 0.95692) +bones/24/rotation = Quaternion(0.351239, -0.0389891, -0.0219293, 0.935217) bones/25/position = Vector3(1.30385e-08, 0.127601, 6.51926e-09) bones/25/rotation = Quaternion(1.49943e-07, -1.20606e-07, 9.91859e-08, 1) bones/26/position = Vector3(2.06034e-08, 0.127601, 2.42761e-08) @@ -119,14 +119,14 @@ bones/42/rotation = Quaternion(-0.120913, 0.799109, 0.0358921, 0.587807) bones/43/rotation = Quaternion(0.498693, -0.0202705, -0.0256953, 0.866161) bones/44/rotation = Quaternion(0.715385, 0.035306, 0.0573145, 0.695481) bones/45/rotation = Quaternion(-0.129059, 0.728936, -0.0250259, 0.67184) -bones/46/position = Vector3(-0.0113635, 1.42485, 0.0415177) -bones/46/rotation = Quaternion(-0.519031, 0.211804, 0.366694, 0.742483) -bones/47/position = Vector3(-0.164846, 1.46159, -0.0452729) -bones/47/rotation = Quaternion(-0.087622, -0.134684, 0.972172, 0.17048) +bones/46/position = Vector3(-0.0113635, 1.4397, 0.0471616) +bones/46/rotation = Quaternion(-0.471331, 0.26399, 0.41501, 0.732068) +bones/47/position = Vector3(-0.177209, 1.47877, -0.0112301) +bones/47/rotation = Quaternion(-0.0114817, -0.147578, 0.976046, 0.159449) bones/48/position = Vector3(1.88476e-07, 0.143946, 1.02445e-08) -bones/48/rotation = Quaternion(-7.58983e-08, 0.00510357, -1.36906e-07, 0.999987) +bones/48/rotation = Quaternion(1.71009e-08, 0.0566237, 7.30339e-08, 0.998396) bones/49/position = Vector3(6.5191e-09, 0.143946, -1.95094e-08) -bones/49/rotation = Quaternion(0.321008, 0.00510392, 0.0288052, 0.946625) +bones/49/rotation = Quaternion(0.391843, 0.0566242, 0.027929, 0.917863) bones/50/position = Vector3(-1.48779e-07, 0.1276, 5.9139e-08) bones/50/rotation = Quaternion(-8.73115e-08, 2.7474e-08, -1.28057e-07, 1) bones/51/position = Vector3(1.9461e-07, 0.127601, 6.06248e-08) @@ -152,19 +152,19 @@ bones/67/rotation = Quaternion(0.108364, -0.768224, 0.166291, 0.608635) bones/68/rotation = Quaternion(0.629954, 0.0295149, 0.0177509, 0.775869) bones/69/rotation = Quaternion(0.816678, -0.0439534, -0.0509861, 0.573155) bones/70/rotation = Quaternion(-0.12906, -0.728937, 0.0250258, 0.67184) -bones/71/position = Vector3(0.127191, 1.34281, -0.0266916) -bones/71/rotation = Quaternion(1.91355e-08, 0.615566, 0.788085, -4.65116e-08) -bones/72/position = Vector3(-0.113426, 1.34281, -0.0266916) -bones/72/rotation = Quaternion(1.91418e-08, 0.615476, 0.788156, -4.65081e-08) +bones/71/position = Vector3(0.127191, 1.36066, -0.0244743) +bones/71/rotation = Quaternion(2.02961e-08, 0.598605, 0.801044, -4.58622e-08) +bones/72/position = Vector3(-0.113426, 1.36066, -0.0244743) +bones/72/rotation = Quaternion(2.02961e-08, 0.598605, 0.801044, -4.58621e-08) [node name="RightHandBone" parent="RigPivot/Rig" index="2"] -transform = Transform3D(-0.962343, -0.270802, -0.0237146, 0.243922, -0.898731, 0.364397, -0.119992, 0.344891, 0.930941, -0.338663, 0.977671, -0.0395404) +transform = Transform3D(-0.962344, -0.2708, -0.0237157, 0.221523, -0.831801, 0.508955, -0.157552, 0.484536, 0.860466, -0.351025, 1.01212, 0.0291318) [node name="LeftHandBone" parent="RigPivot/Rig" index="3"] -transform = Transform3D(-0.970513, 0.239108, 0.0305213, -0.22344, -0.939884, 0.258251, 0.0904365, 0.243817, 0.965595, 0.344773, 0.966514, -0.0555742) +transform = Transform3D(-0.970537, 0.239024, 0.0304279, -0.208926, -0.897704, 0.387914, 0.120036, 0.370127, 0.921193, 0.348214, 0.994824, -0.00788805) [node name="RayAttachment" type="BoneAttachment3D" parent="RigPivot/Rig"] -transform = Transform3D(-0.962343, -0.270802, -0.0237146, 0.243922, -0.898731, 0.364397, -0.119992, 0.344891, 0.930941, -0.338663, 0.977671, -0.0395404) +transform = Transform3D(-0.962344, -0.2708, -0.0237157, 0.221523, -0.831801, 0.508955, -0.157552, 0.484536, 0.860466, -0.351025, 1.01212, 0.0291318) bone_name = "DEF-hand.R" bone_idx = 51 use_external_skeleton = true @@ -188,9 +188,13 @@ player = NodePath("../..") [node name="UserInterface" parent="." node_paths=PackedStringArray("player") instance=ExtResource("9_wdvff")] player = NodePath("..") +[node name="Inventory" parent="UserInterface" index="1" node_paths=PackedStringArray("player")] +player = NodePath("../..") + [connection signal="defeat" from="HealthComponent" to="." method="_on_health_component_defeat"] [connection signal="health_changed" from="HealthComponent" to="UserInterface" method="update_health"] [connection signal="heavy_attack" from="RigPivot/Rig" to="." method="_on_rig_heavy_attack"] [editable path="RigPivot/Rig"] [editable path="RigPivot/Rig/CharacterRig"] +[editable path="UserInterface"] diff --git a/src/scenes/ui/inventory.tscn b/src/scenes/ui/inventory.tscn index 2ff2b2c..4e0d9de 100644 --- a/src/scenes/ui/inventory.tscn +++ b/src/scenes/ui/inventory.tscn @@ -1,9 +1,11 @@ -[gd_scene load_steps=12 format=3 uid="uid://csadps2at3npv"] +[gd_scene load_steps=16 format=3 uid="uid://csadps2at3npv"] [ext_resource type="Texture2D" uid="uid://dhvatbbng4411" path="res://assets/ui/window/window_header.png" id="1_0708f"] +[ext_resource type="Script" uid="uid://ccmiaof7tpjxn" path="res://src/scripts/ui/inventory.gd" id="1_ylnvo"] [ext_resource type="FontFile" uid="uid://sua821wsaeli" path="res://assets/fonts/Candara_Bold.ttf" id="2_apwy2"] [ext_resource type="StyleBox" uid="uid://copt367rq3lyr" path="res://src/resources/ui/ui_panel.tres" id="3_qcfrv"] [ext_resource type="Texture2D" uid="uid://dd48efbhydh3d" path="res://assets/ui/icons/spell_slot_empty_icon.png" id="4_16ir6"] +[ext_resource type="PackedScene" uid="uid://ckwydalda0teo" path="res://src/scenes/characters/rig.tscn" id="5_dryat"] [ext_resource type="FontFile" uid="uid://d3s081dnj7ea4" path="res://assets/fonts/Candara_Italic.ttf" id="5_ylnvo"] [sub_resource type="Gradient" id="Gradient_s4y2v"] @@ -18,6 +20,11 @@ font = ExtResource("2_apwy2") font_size = 48 font_color = Color(0.835294, 0.627451, 0.356863, 1) +[sub_resource type="Environment" id="Environment_dryat"] + +[sub_resource type="World3D" id="World3D_tfrle"] +environment = SubResource("Environment_dryat") + [sub_resource type="LabelSettings" id="LabelSettings_31epi"] font = ExtResource("2_apwy2") font_size = 36 @@ -31,6 +38,8 @@ font_size = 24 [sub_resource type="LabelSettings" id="LabelSettings_tfrle"] font = ExtResource("2_apwy2") font_size = 32 +font_color = Color(0.835294, 0.627451, 0.356863, 1) +shadow_color = Color(0, 0, 0, 1) [node name="Inventory" type="Control"] layout_mode = 3 @@ -39,6 +48,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +script = ExtResource("1_ylnvo") [node name="BackgroundGradient" type="TextureRect" parent="."] layout_mode = 1 @@ -94,6 +104,24 @@ theme_override_styles/panel = ExtResource("3_qcfrv") [node name="SubViewportContainer" type="SubViewportContainer" parent="MarginContainer/VBoxContainer/HBoxContainer"] custom_minimum_size = Vector2(512, 0) layout_mode = 2 +stretch = true + +[node name="SubViewport" type="SubViewport" parent="MarginContainer/VBoxContainer/HBoxContainer/SubViewportContainer"] +world_3d = SubResource("World3D_tfrle") +transparent_bg = true +handle_input_locally = false +size = Vector2i(512, 868) +render_target_update_mode = 4 + +[node name="Rig" parent="MarginContainer/VBoxContainer/HBoxContainer/SubViewportContainer/SubViewport" instance=ExtResource("5_dryat")] + +[node name="Camera3D" type="Camera3D" parent="MarginContainer/VBoxContainer/HBoxContainer/SubViewportContainer/SubViewport"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 3) +fov = 50.8 + +[node name="DirectionalLight3D" type="DirectionalLight3D" parent="MarginContainer/VBoxContainer/HBoxContainer/SubViewportContainer/SubViewport"] +transform = Transform3D(-0.866023, -0.433016, 0.250001, 0.498707, -0.712081, 0.494198, -0.0359752, 0.552664, 0.832627, 0, 0, 0) +shadow_enabled = true [node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer"] custom_minimum_size = Vector2(384, 0) @@ -119,12 +147,12 @@ horizontal_alignment = 1 layout_mode = 2 columns = 2 -[node name="Attribute" type="TextureRect" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer"] +[node name="Attribute1" type="TextureRect" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer"] layout_mode = 2 size_flags_horizontal = 6 texture = ExtResource("4_16ir6") -[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer/Attribute"] +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer/Attribute1"] layout_mode = 1 anchors_preset = 14 anchor_top = 0.5 @@ -133,14 +161,114 @@ anchor_bottom = 0.5 grow_horizontal = 2 grow_vertical = 2 -[node name="AttributeName" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer/Attribute/VBoxContainer"] +[node name="AttributeName" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer/Attribute1/VBoxContainer"] layout_mode = 2 text = "Strength" label_settings = SubResource("LabelSettings_dryat") horizontal_alignment = 1 -[node name="AttributeScore" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer/Attribute/VBoxContainer"] +[node name="StrengthScore" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer/Attribute1/VBoxContainer"] +unique_name_in_owner = true layout_mode = 2 text = "0" label_settings = SubResource("LabelSettings_tfrle") horizontal_alignment = 1 + +[node name="Attribute2" type="TextureRect" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +texture = ExtResource("4_16ir6") + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer/Attribute2"] +layout_mode = 1 +anchors_preset = 14 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="AttributeName" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer/Attribute2/VBoxContainer"] +layout_mode = 2 +text = "Agility" +label_settings = SubResource("LabelSettings_dryat") +horizontal_alignment = 1 + +[node name="AgilityScore" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer/Attribute2/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "0" +label_settings = SubResource("LabelSettings_tfrle") +horizontal_alignment = 1 + +[node name="Attribute3" type="TextureRect" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +texture = ExtResource("4_16ir6") + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer/Attribute3"] +layout_mode = 1 +anchors_preset = 14 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="AttributeName" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer/Attribute3/VBoxContainer"] +layout_mode = 2 +text = "Speed" +label_settings = SubResource("LabelSettings_dryat") +horizontal_alignment = 1 + +[node name="SpeedScore" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer/Attribute3/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "0" +label_settings = SubResource("LabelSettings_tfrle") +horizontal_alignment = 1 + +[node name="Attribute4" type="TextureRect" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +texture = ExtResource("4_16ir6") + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer/Attribute4"] +layout_mode = 1 +anchors_preset = 14 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="AttributeName" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer/Attribute4/VBoxContainer"] +layout_mode = 2 +text = "Endurance" +label_settings = SubResource("LabelSettings_dryat") +horizontal_alignment = 1 + +[node name="EnduranceScore" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/GridContainer/Attribute4/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "0" +label_settings = SubResource("LabelSettings_tfrle") +horizontal_alignment = 1 + +[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer"] +layout_mode = 2 + +[node name="AttackDamageLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Attack damage" +label_settings = SubResource("LabelSettings_dryat") +horizontal_alignment = 1 + +[node name="AttackDamageValue" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/CharacterSheet/VBoxContainer/HBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 +text = "0" +label_settings = SubResource("LabelSettings_tfrle") +horizontal_alignment = 1 diff --git a/src/scripts/characters/health_component.gd b/src/scripts/characters/health_component.gd index 34ecbe8..b65b3fd 100644 --- a/src/scripts/characters/health_component.gd +++ b/src/scripts/characters/health_component.gd @@ -16,7 +16,6 @@ var current_health: float: func update_max_health(max_hp_in: float) -> void: max_health = max_hp_in current_health = max_health - printt("Health changed", max_health, current_health) func take_damage(damage_in: float, is_critical: bool) -> void: var damage = damage_in diff --git a/src/scripts/ui/inventory.gd b/src/scripts/ui/inventory.gd new file mode 100644 index 0000000..89b17b4 --- /dev/null +++ b/src/scripts/ui/inventory.gd @@ -0,0 +1,28 @@ +extends Control + +@onready var level_label: Label = %LevelLabel +@onready var strength_label: Label = %StrengthScore +@onready var agility_label: Label = %AgilityScore +@onready var speed_label: Label = %SpeedScore +@onready var endurance_label: Label = %EnduranceScore +@onready var attack_damage_value: Label = %AttackDamageValue + +@export var player: Player + +func _ready() -> void: + update_stats() + +func update_stats() -> void: + level_label.text = "Level %d" % player.stats.level + strength_label.text = str(player.stats.strength.score) + agility_label.text = str(player.stats.agility.score) + speed_label.text = str(player.stats.speed.score) + endurance_label.text = str(player.stats.endurance.score) + +func update_gear_stats() -> void: + attack_damage_value.text = str(get_weapon_damage_value()) + +func get_weapon_damage_value() -> int: + var damage = 10 + damage += player.stats.strength.get_modifier() + return damage diff --git a/src/scripts/ui/inventory.gd.uid b/src/scripts/ui/inventory.gd.uid new file mode 100644 index 0000000..19a2233 --- /dev/null +++ b/src/scripts/ui/inventory.gd.uid @@ -0,0 +1 @@ +uid://ccmiaof7tpjxn diff --git a/src/scripts/ui/user_interface.gd b/src/scripts/ui/user_interface.gd index d7be60e..6208e18 100644 --- a/src/scripts/ui/user_interface.gd +++ b/src/scripts/ui/user_interface.gd @@ -16,6 +16,7 @@ func update_stats_display() -> void: level_label.text = str(player.stats.level) xp_bar.max_value = player.stats.perc_level_up_boundary() xp_bar.value = player.stats.xp + inventory.update_stats() func update_health() -> void: health_bar.max_value = player.health_component.max_health @@ -25,6 +26,7 @@ func update_health() -> void: func toggle_inventory_menu() -> void: get_tree().paused = !get_tree().paused inventory.visible = !inventory.visible + inventory.update_gear_stats() if inventory.visible: Input.mouse_mode = Input.MOUSE_MODE_VISIBLE else: