From 4200769e1dcfd90315cb6234aa424d10cc9f7cd1 Mon Sep 17 00:00:00 2001 From: Sascha Date: Thu, 6 Jun 2024 16:20:35 +0200 Subject: [PATCH] interactable ui --- packed-scenes/interaction_manager.tscn | 13 +-- packed-scenes/knight_new.tscn | 112 ++++++++++++------------- packed-scenes/ui.tscn | 30 ++++--- scripts/chest.gd | 6 ++ scripts/enemy.gd | 2 - scripts/interaction_manager.gd | 6 +- scripts/player.gd | 8 +- scripts/unit.gd | 8 +- 8 files changed, 102 insertions(+), 83 deletions(-) diff --git a/packed-scenes/interaction_manager.tscn b/packed-scenes/interaction_manager.tscn index a99ff2b..64daf58 100644 --- a/packed-scenes/interaction_manager.tscn +++ b/packed-scenes/interaction_manager.tscn @@ -7,14 +7,17 @@ script = ExtResource("1_cc3nr") [node name="Label" type="Label" parent="."] -anchors_preset = 5 +anchors_preset = 8 anchor_left = 0.5 +anchor_top = 0.5 anchor_right = 0.5 -offset_left = -75.0 -offset_right = 75.0 -offset_bottom = 23.0 +anchor_bottom = 0.5 +offset_left = 17.0 +offset_top = 22.0 +offset_right = 249.0 +offset_bottom = 40.0 grow_horizontal = 2 +grow_vertical = 2 theme = ExtResource("1_i2bdl") text = "[E] or [Y] to interact" -horizontal_alignment = 1 vertical_alignment = 1 diff --git a/packed-scenes/knight_new.tscn b/packed-scenes/knight_new.tscn index 6b943b3..dd6ff5b 100644 --- a/packed-scenes/knight_new.tscn +++ b/packed-scenes/knight_new.tscn @@ -31635,7 +31635,7 @@ states/Jump_Land/position = Vector2(900, 283) states/Jump_Start/node = SubResource("AnimationNodeAnimation_n2bl3") states/Jump_Start/position = Vector2(658, 283) transitions = ["Start", "IWR", SubResource("AnimationNodeStateMachineTransition_l0xk8"), "IWR", "Death_A", SubResource("AnimationNodeStateMachineTransition_0pn5a"), "IWR", "Interact", SubResource("AnimationNodeStateMachineTransition_ddrtj"), "Interact", "IWR", SubResource("AnimationNodeStateMachineTransition_vokpi"), "IWR", "1h_slice_diagonal", SubResource("AnimationNodeStateMachineTransition_w32h3"), "1h_slice_diagonal", "IWR", SubResource("AnimationNodeStateMachineTransition_x8rkg"), "IWR", "1h_attack_chop", SubResource("AnimationNodeStateMachineTransition_ai0h0"), "1h_attack_chop", "IWR", SubResource("AnimationNodeStateMachineTransition_flmvj"), "IWR", "1h_slice_horizontal", SubResource("AnimationNodeStateMachineTransition_hnfj8"), "1h_slice_horizontal", "IWR", SubResource("AnimationNodeStateMachineTransition_17t07"), "IWR", "Jump_Start", SubResource("AnimationNodeStateMachineTransition_4j7ud"), "Jump_Start", "Jump_Idle", SubResource("AnimationNodeStateMachineTransition_mgjn7"), "Jump_Idle", "Jump_Land", SubResource("AnimationNodeStateMachineTransition_eh75m"), "Jump_Land", "IWR", SubResource("AnimationNodeStateMachineTransition_qllfg"), "IWR", "Jump_Idle", SubResource("AnimationNodeStateMachineTransition_vq1x0"), "IWR", "Blocking", SubResource("AnimationNodeStateMachineTransition_pnrta"), "Blocking", "IWR", SubResource("AnimationNodeStateMachineTransition_hku22"), "Blocking", "Block_Hit", SubResource("AnimationNodeStateMachineTransition_ghj3a"), "Block_Hit", "Blocking", SubResource("AnimationNodeStateMachineTransition_os6oe"), "Blocking", "Block_Attack", SubResource("AnimationNodeStateMachineTransition_dips5"), "Block_Attack", "Blocking", SubResource("AnimationNodeStateMachineTransition_ar41x"), "Block_Attack", "IWR", SubResource("AnimationNodeStateMachineTransition_sxuk5"), "IWR", "Hit_A", SubResource("AnimationNodeStateMachineTransition_skg6m"), "Hit_A", "IWR", SubResource("AnimationNodeStateMachineTransition_sufwf"), "IWR", "Hit_B", SubResource("AnimationNodeStateMachineTransition_5gf1y"), "Hit_B", "IWR", SubResource("AnimationNodeStateMachineTransition_gjm3q"), "IWR", "Death_B", SubResource("AnimationNodeStateMachineTransition_vc3og")] -graph_offset = Vector2(-336, -146.186) +graph_offset = Vector2(-318, -48.186) [node name="Knight" type="CharacterBody3D" node_paths=PackedStringArray("model")] transform = Transform3D(0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0) @@ -31663,43 +31663,43 @@ bones/0/name = "root" bones/0/parent = -1 bones/0/rest = Transform3D(1, 0, 2.38419e-07, 0, 1, 0, -2.38419e-07, 0, 1, 0, 0, 0) bones/0/enabled = true -bones/0/position = Vector3(0, 2.41992e-05, 0) +bones/0/position = Vector3(0, 1.00374e-05, 0) bones/0/rotation = Quaternion(-1.16323e-11, 0.000338143, 2.01478e-11, 1) bones/0/scale = Vector3(1, 1, 1) bones/1/name = "hips" bones/1/parent = 0 bones/1/rest = Transform3D(1, 0, -2.38419e-07, 0, 1, 0, 2.38419e-07, 0, 1, 0, 0.405663, 0) bones/1/enabled = true -bones/1/position = Vector3(-7.38028e-20, 0.37912, 4.99586e-19) -bones/1/rotation = Quaternion(0.000325067, 0.0430087, -5.8962e-05, 0.999075) +bones/1/position = Vector3(-1.35343e-20, 0.369326, 7.63522e-19) +bones/1/rotation = Quaternion(0.000343616, 0.0430085, -5.9744e-05, 0.999075) bones/1/scale = Vector3(1, 1, 1) bones/2/name = "spine" bones/2/parent = 1 bones/2/rest = Transform3D(1, 0, 1.42109e-14, 0, 1, 0, -1.42109e-14, 0, 1, 0, 0.191978, 0) bones/2/enabled = true bones/2/position = Vector3(0, 0.191978, 0) -bones/2/rotation = Quaternion(0.000396529, -0.000289032, 4.72153e-05, 1) +bones/2/rotation = Quaternion(0.000395253, -6.58481e-05, 3.20806e-05, 1) bones/2/scale = Vector3(1, 1, 1) bones/3/name = "chest" bones/3/parent = 2 bones/3/rest = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.374988, 0) bones/3/enabled = true bones/3/position = Vector3(0, 0.374988, 0) -bones/3/rotation = Quaternion(0.000159246, -0.000103164, 3.32076e-05, 1) +bones/3/rotation = Quaternion(0.000155677, -9.94708e-05, 5.22203e-05, 1) bones/3/scale = Vector3(1, 1, 1) bones/4/name = "upperarm.l" bones/4/parent = 3 bones/4/rest = Transform3D(0.0572842, 0.998357, -3.57628e-07, -3.57628e-07, 4.76837e-07, 1, 0.998357, -0.0572841, 4.76837e-07, 0.212007, 0.134132, 8.40246e-08) bones/4/enabled = true -bones/4/position = Vector3(0.211948, 0.13407, -0.000148596) -bones/4/rotation = Quaternion(-0.55649, -0.05814, -0.63764, 0.529485) +bones/4/position = Vector3(0.211968, 0.13408, -0.000153968) +bones/4/rotation = Quaternion(-0.551315, -0.0584601, -0.643603, 0.527645) bones/4/scale = Vector3(0.999999, 0.999999, 1) bones/5/name = "lowerarm.l" bones/5/parent = 4 bones/5/rest = Transform3D(0.993887, 0.110402, -1.19007e-07, -0.110402, 0.993887, 3.28831e-09, 1.18643e-07, 9.87045e-09, 1, -3.21966e-09, 0.241897, -1.19406e-07) bones/5/enabled = true bones/5/position = Vector3(-3.21966e-09, 0.241897, -1.19406e-07) -bones/5/rotation = Quaternion(2.54806e-08, -5.37804e-08, -0.51068, 0.859771) +bones/5/rotation = Quaternion(2.22552e-08, -6.11204e-08, -0.504744, 0.863269) bones/5/scale = Vector3(1, 1, 1) bones/6/name = "wrist.l" bones/6/parent = 5 @@ -31713,14 +31713,14 @@ bones/7/parent = 6 bones/7/rest = Transform3D(1, 1.09104e-05, 2.66204e-07, -1.09104e-05, 1, -2.40181e-09, -2.66204e-07, 2.39891e-09, 1, 9.08162e-13, 0.0738258, 2.22045e-16) bones/7/enabled = true bones/7/position = Vector3(9.08162e-13, 0.0738258, 2.22045e-16) -bones/7/rotation = Quaternion(-0.320803, -0.333883, 0.148833, 0.87376) +bones/7/rotation = Quaternion(-0.318339, -0.337777, 0.143837, 0.874001) bones/7/scale = Vector3(1, 1, 1) bones/8/name = "handslot.l" bones/8/parent = 7 bones/8/rest = Transform3D(-1.19209e-07, 1, -2.22045e-16, -1, -1.19209e-07, -4.55307e-09, -4.55307e-09, -2.22045e-16, 1, 8.34815e-10, 0.0961251, -0.0575001) bones/8/enabled = true bones/8/position = Vector3(5.50255e-10, 0.0961252, -0.0575) -bones/8/rotation = Quaternion(0.000275242, 0.000655316, -0.7049, 0.709306) +bones/8/rotation = Quaternion(0.00121083, 0.00157948, -0.701446, 0.71272) bones/8/scale = Vector3(1, 1, 1) bones/9/name = "1H_Sword_Offhand" bones/9/parent = 8 @@ -31761,15 +31761,15 @@ bones/14/name = "upperarm.r" bones/14/parent = 3 bones/14/rest = Transform3D(0.0572841, -0.998357, 4.47035e-07, 5.06639e-07, 4.17232e-07, 1, -0.998357, -0.0572842, 4.76837e-07, -0.212007, 0.134132, 8.40246e-08) bones/14/enabled = true -bones/14/position = Vector3(-0.21198, 0.134087, -0.000157408) -bones/14/rotation = Quaternion(-0.614501, 0.078681, 0.613368, 0.489875) +bones/14/position = Vector3(-0.21196, 0.134077, -0.000152037) +bones/14/rotation = Quaternion(-0.610058, 0.0789402, 0.618563, 0.488853) bones/14/scale = Vector3(0.999999, 0.999999, 1) bones/15/name = "lowerarm.r" bones/15/parent = 14 bones/15/rest = Transform3D(0.993887, -0.110402, 1.19007e-07, 0.110402, 0.993887, 3.28831e-09, -1.18643e-07, 9.87045e-09, 1, -7.12186e-11, 0.241897, -1.19406e-07) bones/15/enabled = true bones/15/position = Vector3(-7.12186e-11, 0.241897, -1.19406e-07) -bones/15/rotation = Quaternion(1.41217e-08, 6.13461e-08, 0.532996, 0.846118) +bones/15/rotation = Quaternion(2.96521e-08, 5.74466e-08, 0.527224, 0.849726) bones/15/scale = Vector3(1, 1, 1) bones/16/name = "wrist.r" bones/16/parent = 15 @@ -31783,14 +31783,14 @@ bones/17/parent = 16 bones/17/rest = Transform3D(1, -1.09104e-05, -1.78637e-07, 1.09104e-05, 1, -2.40084e-09, 1.78637e-07, 2.39889e-09, 1, 1.33227e-15, 0.0738258, 2.22045e-16) bones/17/enabled = true bones/17/position = Vector3(1.33227e-15, 0.0738258, 2.22045e-16) -bones/17/rotation = Quaternion(-0.319393, 0.309859, -0.230593, 0.865333) +bones/17/rotation = Quaternion(-0.317347, 0.313464, -0.225458, 0.866141) bones/17/scale = Vector3(1, 1, 1) bones/18/name = "handslot.r" bones/18/parent = 17 bones/18/rest = Transform3D(-1.19209e-07, -1, 2.22045e-16, 1, -1.19209e-07, -4.55301e-09, 4.55301e-09, -2.22045e-16, 1, -8.34815e-10, 0.0961251, -0.0575001) bones/18/enabled = true bones/18/position = Vector3(-1.55245e-08, 0.0961251, -0.0575) -bones/18/rotation = Quaternion(0.00124669, 0.0016181, 0.704974, 0.70923) +bones/18/rotation = Quaternion(0.00397747, 0.0048516, 0.702108, 0.712043) bones/18/scale = Vector3(1, 1, 1) bones/19/name = "1H_Sword" bones/19/parent = 18 @@ -31811,7 +31811,7 @@ bones/21/parent = 3 bones/21/rest = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.268797, 0) bones/21/enabled = true bones/21/position = Vector3(0, 0.268797, 0) -bones/21/rotation = Quaternion(-0.000435698, -0.0311305, 2.28049e-05, 0.999515) +bones/21/rotation = Quaternion(-0.000439715, -0.0313644, 3.69645e-05, 0.999508) bones/21/scale = Vector3(1, 1, 1) bones/22/name = "Knight_Helmet" bones/22/parent = 21 @@ -31831,71 +31831,71 @@ bones/24/name = "upperleg.l" bones/24/parent = 1 bones/24/rest = Transform3D(1, -1.42215e-07, -2.65602e-08, -1.43052e-07, -0.999396, -0.0347412, -2.16035e-08, 0.0347411, -0.999398, 0.170945, 0.113587, 1.39233e-08) bones/24/enabled = true -bones/24/position = Vector3(0.170945, 0.113587, 5.75323e-05) -bones/24/rotation = Quaternion(0.991697, 0.0828187, 0.0768218, 0.0614492) +bones/24/position = Vector3(0.170945, 0.113587, 0.000253323) +bones/24/rotation = Quaternion(0.989489, 0.0833101, 0.0786397, 0.0882426) bones/24/scale = Vector3(1, 1, 1) bones/25/name = "lowerleg.l" bones/25/parent = 24 bones/25/rest = Transform3D(1, 1.6129e-07, 1.20856e-07, -1.3212e-07, 0.977433, -0.211248, -1.52201e-07, 0.211248, 0.977433, 3.57982e-09, 0.227077, -6.13986e-09) bones/25/enabled = true bones/25/position = Vector3(3.57982e-09, 0.227077, -6.13986e-09) -bones/25/rotation = Quaternion(0.327776, 5.96002e-08, -2.26571e-07, 0.944755) +bones/25/rotation = Quaternion(0.395314, 6.19124e-08, -2.66344e-07, 0.918546) bones/25/scale = Vector3(1, 1, 1) bones/26/name = "foot.l" bones/26/parent = 25 bones/26/rest = Transform3D(1, 4.64335e-08, 6.01239e-08, -7.59277e-08, 0.585515, 0.810661, 2.4383e-09, -0.810662, 0.585514, 1.83222e-10, 0.149437, 9.66537e-10) bones/26/enabled = true bones/26/position = Vector3(1.83222e-10, 0.149437, 9.66537e-10) -bones/26/rotation = Quaternion(-0.584909, -0.204047, 0.0640241, 0.782398) +bones/26/rotation = Quaternion(-0.620746, -0.200329, 0.0760844, 0.754158) bones/26/scale = Vector3(1, 1, 0.999999) bones/27/name = "toes.l" bones/27/parent = 26 bones/27/rest = Transform3D(-1, -1.75424e-09, 1.51741e-07, -1.10452e-07, 0.694106, -0.719873, -1.04062e-07, -0.719873, -0.694106, -2.1306e-10, 0.16565, 5.17174e-09) bones/27/enabled = true bones/27/position = Vector3(-2.1306e-10, 0.16565, 5.17174e-09) -bones/27/rotation = Quaternion(-9.81294e-09, 0.920355, -0.391084, 7.82799e-08) +bones/27/rotation = Quaternion(-9.81439e-09, 0.920355, -0.391084, 7.82811e-08) bones/27/scale = Vector3(1, 1, 1) bones/28/name = "upperleg.r" bones/28/parent = 1 bones/28/rest = Transform3D(1, 1.49611e-07, -6.08626e-08, 1.47406e-07, -0.999396, -0.0347412, -6.60234e-08, 0.0347411, -0.999398, -0.170945, 0.113587, 1.39233e-08) bones/28/enabled = true -bones/28/position = Vector3(-0.170945, 0.113587, -5.75007e-05) -bones/28/rotation = Quaternion(0.994084, -0.0316526, 0.0303498, 0.099372) +bones/28/position = Vector3(-0.170945, 0.113587, -0.000253291) +bones/28/rotation = Quaternion(0.991485, -0.0332196, 0.0297068, 0.122354) bones/28/scale = Vector3(1, 1, 1) bones/29/name = "lowerleg.r" bones/29/parent = 28 bones/29/rest = Transform3D(1, -1.6129e-07, -1.20856e-07, 1.3212e-07, 0.977433, -0.211248, 1.52201e-07, 0.211248, 0.977433, -3.57982e-09, 0.227077, -6.13986e-09) bones/29/enabled = true bones/29/position = Vector3(-3.57982e-09, 0.227077, -6.13986e-09) -bones/29/rotation = Quaternion(0.377137, -6.0943e-08, 2.63572e-07, 0.926158) +bones/29/rotation = Quaternion(0.43854, -5.78574e-08, 3.05204e-07, 0.898711) bones/29/scale = Vector3(1, 1, 1) bones/30/name = "foot.r" bones/30/parent = 29 bones/30/rest = Transform3D(1, -1.55132e-07, 2.93521e-07, -1.47115e-07, 0.585515, 0.810661, -2.97621e-07, -0.810662, 0.585514, -1.83221e-10, 0.149437, 9.66542e-10) bones/30/enabled = true bones/30/position = Vector3(-1.83221e-10, 0.149437, 9.66542e-10) -bones/30/rotation = Quaternion(-0.613984, 0.113126, -0.0175029, 0.780974) +bones/30/rotation = Quaternion(-0.646849, 0.112124, -0.0230804, 0.753977) bones/30/scale = Vector3(1, 1, 0.999999) bones/31/name = "toes.r" bones/31/parent = 30 bones/31/rest = Transform3D(-1, 1.75425e-09, -1.51741e-07, 1.10452e-07, 0.694106, -0.719873, 1.04062e-07, -0.719873, -0.694106, 2.13058e-10, 0.16565, 5.17174e-09) bones/31/enabled = true bones/31/position = Vector3(2.13058e-10, 0.16565, 5.17174e-09) -bones/31/rotation = Quaternion(3.03024e-08, 0.920283, -0.391254, -6.95318e-08) +bones/31/rotation = Quaternion(3.01215e-08, 0.920031, -0.391846, -6.95126e-08) bones/31/scale = Vector3(1, 1, 1) bones/32/name = "kneeIK.l" bones/32/parent = 0 bones/32/rest = Transform3D(1, -2.59151e-07, -3.89414e-07, -3.89414e-07, 0, -1, 2.59151e-07, 1, 0, 0.170945, 0.29231, 0.575812) bones/32/enabled = true -bones/32/position = Vector3(0.170945, 0.292574, 0.576076) +bones/32/position = Vector3(0.170945, 0.292614, 0.576116) bones/32/rotation = Quaternion(0.707107, -2.29309e-07, -4.60484e-08, 0.707107) bones/32/scale = Vector3(1, 1, 1) bones/33/name = "control-toe-roll.l" bones/33/parent = 0 bones/33/rest = Transform3D(1, 1.99485e-07, -3.55271e-14, 3.55271e-14, 0, 1, 1.99485e-07, -1, 0, 0.170945, 0.0259903, 0.245789) bones/33/enabled = true -bones/33/position = Vector3(0.202077, 0.0260981, 0.20424) -bones/33/rotation = Quaternion(-0.705425, -7.06765e-08, -7.03851e-08, 0.708785) +bones/33/position = Vector3(0.202077, 0.0260268, 0.205746) +bones/33/rotation = Quaternion(-0.706659, -7.05468e-08, -7.05084e-08, 0.707555) bones/33/scale = Vector3(1, 1, 1) bones/34/name = "control-heel-roll.l" bones/34/parent = 33 @@ -31936,15 +31936,15 @@ bones/39/name = "kneeIK.r" bones/39/parent = 0 bones/39/rest = Transform3D(1, -2.59151e-07, 1.50996e-07, 1.50996e-07, 0, -1, 2.59151e-07, 1, 0, -0.170945, 0.29231, 0.575812) bones/39/enabled = true -bones/39/position = Vector3(-0.170945, 0.292574, 0.576076) +bones/39/position = Vector3(-0.170945, 0.292614, 0.576116) bones/39/rotation = Quaternion(0.707107, -3.82453e-08, 1.45016e-07, 0.707107) bones/39/scale = Vector3(1, 1, 1) bones/40/name = "control-toe-roll.r" bones/40/parent = 0 bones/40/rest = Transform3D(1, 1.99485e-07, 0, 0, 0, 1, 1.99485e-07, -1, 0, -0.170945, 0.0259903, 0.245789) bones/40/enabled = true -bones/40/position = Vector3(-0.170945, 0.0259013, 0.245703) -bones/40/rotation = Quaternion(-0.707008, -7.05389e-08, -7.05187e-08, 0.707206) +bones/40/position = Vector3(-0.170945, 0.0258327, 0.244649) +bones/40/rotation = Quaternion(-0.706226, -7.06267e-08, -7.04283e-08, 0.707987) bones/40/scale = Vector3(1, 1, 1) bones/41/name = "control-heel-roll.r" bones/41/parent = 40 @@ -31992,8 +31992,8 @@ bones/47/name = "handIK.l" bones/47/parent = 0 bones/47/rest = Transform3D(-2.38419e-07, 1, 0, 0, 0, 1, 1, 2.38419e-07, 0, 0.713181, 1.10676, 2.54914e-07) bones/47/enabled = true -bones/47/position = Vector3(0.520733, 0.781964, -0.0566607) -bones/47/rotation = Quaternion(0.79535, 0.00174166, 0.606148, 0.000416028) +bones/47/position = Vector3(0.520733, 0.769682, -0.0566448) +bones/47/rotation = Quaternion(0.795364, 0.00175852, 0.60613, 0.00042026) bones/47/scale = Vector3(1, 1, 1) bones/48/name = "elbowIK.r" bones/48/parent = 0 @@ -32006,12 +32006,12 @@ bones/49/name = "handIK.r" bones/49/parent = 0 bones/49/rest = Transform3D(1.19209e-07, -1, -1.19209e-07, 0, -1.19209e-07, 1, -1, -1.19209e-07, 0, -0.713182, 1.10676, -8.51573e-08) bones/49/enabled = true -bones/49/position = Vector3(-0.510854, 0.781964, 0.0599578) -bones/49/rotation = Quaternion(0.759224, -0.00152137, -0.650828, 0.000159227) +bones/49/position = Vector3(-0.510854, 0.769682, 0.0599737) +bones/49/rotation = Quaternion(0.759239, -0.00153795, -0.65081, 0.000164424) bones/49/scale = Vector3(1, 1, 1) [node name="1H_Sword_Offhand" type="BoneAttachment3D" parent="Rig/Skeleton3D"] -transform = Transform3D(-0.00272315, 0.263916, 0.964541, 0.999987, -0.00319168, 0.00369743, 0.00405475, 0.96454, -0.263904, 0.512751, 0.630897, -0.000571791) +transform = Transform3D(-0.00252077, 0.263868, 0.964555, 0.999898, -0.0128597, 0.00613201, 0.0140223, 0.964472, -0.263809, 0.512352, 0.617837, -0.00105227) visible = false bone_name = "1H_Sword_Offhand" bone_idx = 9 @@ -32021,7 +32021,7 @@ mesh = SubResource("ArrayMesh_rvosg") skeleton = NodePath("") [node name="Badge_Shield" type="BoneAttachment3D" parent="Rig/Skeleton3D"] -transform = Transform3D(-0.00272312, 0.263916, 0.964541, 0.999987, -0.00319421, 0.0036981, 0.00405737, 0.96454, -0.263904, 0.663108, 0.631473, -0.0417104) +transform = Transform3D(-0.00252075, 0.263868, 0.964555, 0.999898, -0.0128623, 0.00613267, 0.0140249, 0.964472, -0.263809, 0.662712, 0.618793, -0.0421761) visible = false bone_name = "Badge_Shield" bone_idx = 10 @@ -32031,7 +32031,7 @@ mesh = SubResource("ArrayMesh_0xags") skeleton = NodePath("") [node name="Rectangle_Shield" type="BoneAttachment3D" parent="Rig/Skeleton3D"] -transform = Transform3D(-0.00272312, 0.263916, 0.964541, 0.999987, -0.00319421, 0.0036981, 0.00405737, 0.96454, -0.263904, 0.663108, 0.631473, -0.0417104) +transform = Transform3D(-0.00252075, 0.263868, 0.964555, 0.999898, -0.0128623, 0.00613267, 0.0140249, 0.964472, -0.263809, 0.662712, 0.618793, -0.0421761) visible = false bone_name = "Rectangle_Shield" bone_idx = 11 @@ -32041,7 +32041,7 @@ mesh = SubResource("ArrayMesh_qr44s") skeleton = NodePath("") [node name="Round_Shield" type="BoneAttachment3D" parent="Rig/Skeleton3D"] -transform = Transform3D(-0.00272312, 0.263916, 0.964541, 0.999987, -0.00319421, 0.0036981, 0.00405737, 0.96454, -0.263904, 0.663108, 0.631473, -0.0417104) +transform = Transform3D(-0.00252075, 0.263868, 0.964555, 0.999898, -0.0128623, 0.00613267, 0.0140249, 0.964472, -0.263809, 0.662712, 0.618793, -0.0421761) bone_name = "Round_Shield" bone_idx = 12 @@ -32050,7 +32050,7 @@ mesh = SubResource("ArrayMesh_bb24p") skeleton = NodePath("") [node name="Spike_Shield" type="BoneAttachment3D" parent="Rig/Skeleton3D"] -transform = Transform3D(-0.00272312, 0.263916, 0.964541, 0.999987, -0.00319421, 0.0036981, 0.00405737, 0.96454, -0.263904, 0.663108, 0.631473, -0.0417104) +transform = Transform3D(-0.00252075, 0.263868, 0.964555, 0.999898, -0.0128623, 0.00613267, 0.0140249, 0.964472, -0.263809, 0.662712, 0.618793, -0.0421761) bone_name = "Spike_Shield" bone_idx = 13 @@ -32059,7 +32059,7 @@ mesh = SubResource("ArrayMesh_jnwr3") skeleton = NodePath("") [node name="1H_Sword" type="BoneAttachment3D" parent="Rig/Skeleton3D"] -transform = Transform3D(0.00085545, -0.155294, 0.987867, 0.999996, -0.00245593, -0.00125288, 0.00262118, 0.987864, 0.155291, -0.496188, 0.635042, 0.141202) +transform = Transform3D(-0.000972711, -0.163773, 0.986497, 0.999943, -0.0106163, -0.00077749, 0.0106007, 0.98644, 0.163773, -0.496358, 0.621896, 0.140596) bone_name = "1H_Sword" bone_idx = 19 @@ -32078,7 +32078,7 @@ shape = SubResource("CapsuleShape3D_nge0l") disabled = true [node name="2H_Sword" type="BoneAttachment3D" parent="Rig/Skeleton3D"] -transform = Transform3D(0.000855434, -0.155294, 0.987867, 0.999996, -0.00245595, -0.00125287, 0.00262119, 0.987864, 0.155291, -0.496188, 0.635042, 0.141202) +transform = Transform3D(-0.000972727, -0.163773, 0.986497, 0.999943, -0.0106163, -0.000777476, 0.0106007, 0.98644, 0.163773, -0.496358, 0.621896, 0.140596) bone_name = "2H_Sword" bone_idx = 20 @@ -32087,7 +32087,7 @@ mesh = SubResource("ArrayMesh_ys2n7") skeleton = NodePath("") [node name="Knight_Helmet" type="BoneAttachment3D" parent="Rig/Skeleton3D"] -transform = Transform3D(0.99972, -1.14772e-05, 0.0236623, 3.27237e-05, 1, -0.000897519, -0.0236623, 0.000898042, 0.99972, 9.60435e-05, 1.18937, 0.00111621) +transform = Transform3D(0.99972, -4.54446e-05, 0.0236475, 6.71788e-05, 1, -0.000918297, -0.0236475, 0.000919628, 0.99972, 0.000108647, 1.17956, 0.00114223) bone_name = "Knight_Helmet" bone_idx = 22 @@ -32106,7 +32106,7 @@ transform = Transform3D(-0.999711, 2.27778e-05, 0.024046, 5.34939e-07, 1, -0.000 shape = SubResource("CapsuleShape3D_i3cyd") [node name="Knight_Cape" type="BoneAttachment3D" parent="Rig/Skeleton3D"] -transform = Transform3D(0.99631, 8.17928e-05, 0.0858299, 7.00531e-05, 0.999998, -0.00176614, -0.0858299, 0.00176563, 0.996308, 9.31756e-05, 1.18937, 0.00109404) +transform = Transform3D(0.996271, 7.67338e-05, 0.0862815, 7.83122e-05, 0.999998, -0.00179359, -0.0862815, 0.00179366, 0.996269, 0.000105041, 1.17956, 0.0011199) visible = false bone_name = "Knight_Cape" bone_idx = 23 @@ -32148,8 +32148,8 @@ libraries = { tree_root = SubResource("AnimationNodeStateMachine_vnar2") anim_player = NodePath("../AnimationPlayer") parameters/current_length = 1.06667 -parameters/current_position = 0.280315 -parameters/current_delta = 0.0166667 +parameters/current_position = 0.60941 +parameters/current_delta = 0.014607 parameters/conditions/blocking = false parameters/conditions/grounded = false parameters/conditions/jumping = false @@ -32188,15 +32188,15 @@ parameters/Hit_B/current_length = 0.866667 parameters/Hit_B/current_position = 0.866667 parameters/Hit_B/current_delta = 0.0202171 parameters/IWR/current_length = 1.06667 -parameters/IWR/current_position = 0.280315 -parameters/IWR/current_delta = 0.0166667 +parameters/IWR/current_position = 0.60941 +parameters/IWR/current_delta = 0.014607 parameters/IWR/blend_position = Vector2(-0.000645578, 0.0027101) parameters/IWR/0/current_length = 1.06667 -parameters/IWR/0/current_position = 0.280315 -parameters/IWR/0/current_delta = 0.0166667 +parameters/IWR/0/current_position = 0.60941 +parameters/IWR/0/current_delta = 0.014607 parameters/IWR/1/current_length = 0.8 -parameters/IWR/1/current_position = 0.547855 -parameters/IWR/1/current_delta = 0.0166667 +parameters/IWR/1/current_position = 0.61114 +parameters/IWR/1/current_delta = 0.014607 parameters/IWR/2/current_length = 1.06667 parameters/IWR/2/current_position = 0.475417 parameters/IWR/2/current_delta = 0.0166667 @@ -32204,8 +32204,8 @@ parameters/IWR/3/current_length = 0.8 parameters/IWR/3/current_position = 0.446801 parameters/IWR/3/current_delta = 0.0166667 parameters/IWR/4/current_length = 0.8 -parameters/IWR/4/current_position = 0.547855 -parameters/IWR/4/current_delta = 0.0166667 +parameters/IWR/4/current_position = 0.61114 +parameters/IWR/4/current_delta = 0.014607 parameters/Interact/current_length = 1.3 parameters/Interact/current_position = 1.3 parameters/Interact/current_delta = 0.0308084 diff --git a/packed-scenes/ui.tscn b/packed-scenes/ui.tscn index 8647502..7c9045b 100644 --- a/packed-scenes/ui.tscn +++ b/packed-scenes/ui.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=3 format=3 uid="uid://d1vowjv6aed2s"] +[gd_scene load_steps=4 format=3 uid="uid://d1vowjv6aed2s"] [ext_resource type="Script" path="res://scripts/ui.gd" id="1_ccvhj"] [ext_resource type="Texture2D" uid="uid://dusuxbeon1rsm" path="res://resources/images/white1x1.png" id="1_epsdw"] +[ext_resource type="Theme" uid="uid://b3faaa6kmpthu" path="res://resources/themes/standard_theme.tres" id="2_idm21"] [node name="UI" type="Control"] layout_mode = 3 @@ -17,11 +18,12 @@ layout_mode = 1 anchors_preset = 2 anchor_top = 1.0 anchor_bottom = 1.0 -offset_left = 17.0 -offset_top = -67.0 -offset_right = 317.0 -offset_bottom = -17.0 +offset_left = 16.0 +offset_top = -24.0 +offset_right = 316.0 +offset_bottom = -14.0 grow_vertical = 0 +theme = ExtResource("2_idm21") value = 67.0 nine_patch_stretch = true texture_under = ExtResource("1_epsdw") @@ -33,11 +35,12 @@ layout_mode = 1 anchors_preset = 2 anchor_top = 1.0 anchor_bottom = 1.0 -offset_left = 17.0 -offset_top = -130.0 -offset_right = 317.0 -offset_bottom = -80.0 +offset_left = 16.0 +offset_top = -40.0 +offset_right = 316.0 +offset_bottom = -30.0 grow_vertical = 0 +theme = ExtResource("2_idm21") value = 67.0 nine_patch_stretch = true texture_under = ExtResource("1_epsdw") @@ -49,10 +52,11 @@ layout_mode = 1 anchors_preset = 2 anchor_top = 1.0 anchor_bottom = 1.0 -offset_left = 17.0 -offset_top = -167.0 -offset_right = 317.0 -offset_bottom = -144.0 +offset_left = 16.0 +offset_top = -72.0 +offset_right = 316.0 +offset_bottom = -49.0 grow_vertical = 0 +theme = ExtResource("2_idm21") text = "Gold: 0" vertical_alignment = 1 diff --git a/scripts/chest.gd b/scripts/chest.gd index e2bcdc5..a3bdfc6 100644 --- a/scripts/chest.gd +++ b/scripts/chest.gd @@ -17,7 +17,12 @@ func _on_interact() -> void: match state: States.closed: state = States.opened + if is_empty: + interaction_area.action_name = "close" + else: + interaction_area.action_name = "collect" States.opened: + interaction_area.action_name = "close" if is_empty: state = States.closed else: @@ -25,6 +30,7 @@ func _on_interact() -> void: GameManager.player.gold += gold_amount state = States.looted States.looted: + interaction_area.action_name = "open" state = States.closed func _on_state_changed(new_state: States) -> void: diff --git a/scripts/enemy.gd b/scripts/enemy.gd index 8e0e52a..10fcd93 100644 --- a/scripts/enemy.gd +++ b/scripts/enemy.gd @@ -50,8 +50,6 @@ func _on_state_changed(new_state: States) -> void: anim_state.travel(attacks.pick_random()) States.dead: player.gold += 1 - #TODO: Slightly disapear - func _on_velocity_computed(safe_velocity: Vector3) -> void: velocity = safe_velocity diff --git a/scripts/interaction_manager.gd b/scripts/interaction_manager.gd index 944993e..3514414 100644 --- a/scripts/interaction_manager.gd +++ b/scripts/interaction_manager.gd @@ -21,9 +21,9 @@ func _process(_delta: float) -> void: active_areas.sort_custom(_sort_by_distance_to_player) var active_area = active_areas[0] as InteractionArea label.text = base_text + active_area.action_name - label.global_position = Vector2(active_area.global_position.x, active_area.global_position.y) - label.global_position.y -= 36 - label.global_position.x -= label.size.x / 2 + #label.global_position = Vector2(active_area.global_position.x, active_area.global_position.y) + #label.global_position.y -= 36 + #label.global_position.x -= label.size.x / 2 label.show() else: label.hide() diff --git a/scripts/player.gd b/scripts/player.gd index 1384b5a..ce59fc7 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -35,6 +35,8 @@ func _ready() -> void: func _on_state_changed(new_state: States) -> void: match new_state: + States.blocking: + print("Player is blocking!") States.dead: game_over.emit() @@ -64,8 +66,10 @@ func _input(event: InputEvent) -> void: if event.is_action_pressed("attack"): if enough_stamina_available(attack_cost): use_stamina(attack_cost) - if state == States.blocking: anim_state.travel("Block_Attack") - else: anim_state.travel(attacks.pick_random()) + if state == States.blocking: + anim_state.travel("Block_Attack") + else: + anim_state.travel(attacks.pick_random()) #block if Input.is_action_just_pressed("block"): state = States.blocking diff --git a/scripts/unit.gd b/scripts/unit.gd index a2f1b65..be4ef4b 100644 --- a/scripts/unit.gd +++ b/scripts/unit.gd @@ -77,8 +77,12 @@ func _process(delta: float) -> void: stamina_timer = 0 func take_damage(damage_amount: int) -> void: - print(unit_name + " gets " + str(damage_amount) + " damage. Life: " + str(health) + "/" + str(maximum_health)) - health -= damage_amount + if state == States.blocking: + print("blocked the attack!") + anim_state.travel("Block_Hit") + else: + print(unit_name + " gets " + str(damage_amount) + " damage. Life: " + str(health) + "/" + str(maximum_health)) + health -= damage_amount func enough_stamina_available(stamina_needed: int) -> bool: return stamina_needed <= stamina