Add knockback to secondary attack

This commit is contained in:
2024-10-14 23:22:42 -07:00
parent df89a2e4d6
commit 8d4177f8b1
5 changed files with 188 additions and 47 deletions

View File

@@ -3,6 +3,7 @@ using Chickensoft.Collections;
using Chickensoft.GodotNodeInterfaces;
using Chickensoft.Introspection;
using Godot;
using static System.Net.Mime.MediaTypeNames;
namespace GameJamDungeon
{
@@ -34,6 +35,10 @@ namespace GameJamDungeon
[Dependency] public IGameRepo GameRepo => this.DependOn<IGameRepo>();
[Dependency] public IGameEventDepot GameEventDepot => this.DependOn<IGameEventDepot>();
[Dependency] public IGame Game => this.DependOn<IGame>();
[Node] public AnimationTree AnimationTree { get; set; } = default!;
[Node] public Timer AttackTimer { get; set; } = default!;
@@ -42,6 +47,10 @@ namespace GameJamDungeon
[Node] public Area3D Hitbox { get; set; } = default!;
[Node] public Area3D AttackBox { get; set; } = default!;
[Node] public Area3D SecondaryAttackBox { get; set; } = default!;
public AutoProp<double> CurrentHP { get; set; }
public void Setup()
@@ -69,6 +78,28 @@ namespace GameJamDungeon
AttackTimer.Timeout += AttackTimer_Timeout;
Hitbox.AreaEntered += Hitbox_AreaEntered;
HitAnimation.AnimationFinished += HitAnimation_AnimationFinished;
AttackBox.AreaEntered += AttackBox_AreaEntered;
SecondaryAttackBox.AreaEntered += SecondaryAttackBox_AreaEntered;
}
private void AttackBox_AreaEntered(Area3D area)
{
var bossHitDamage = DamageCalculator.CalculateEnemyAttackDamage(GameRepo.PlayerData.CurrentDefense.Value + GameRepo.PlayerData.BonusDefense,
BossResource,
GameRepo.PlayerData.Inventory.EquippedArmor.Value.ArmorStats,
false);
GameRepo.PlayerData.SetCurrentHP(GameRepo.PlayerData.CurrentHP.Value - Mathf.RoundToInt(bossHitDamage));
}
private void SecondaryAttackBox_AreaEntered(Area3D area)
{
var bossHitDamage = DamageCalculator.CalculateEnemyAttackDamage(GameRepo.PlayerData.CurrentDefense.Value + GameRepo.PlayerData.BonusDefense,
BossResource,
GameRepo.PlayerData.Inventory.EquippedArmor.Value.ArmorStats,
false);
var nerfDamage = bossHitDamage *= 0.25f;
GameRepo.PlayerData.SetCurrentHP(GameRepo.PlayerData.CurrentHP.Value - Mathf.RoundToInt(nerfDamage));
Game.Player.ApplyCentralImpulseToPlayer(GlobalBasis.Z.Normalized());
}
private void HitAnimation_AnimationFinished(StringName animName)

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=34 format=4 uid="uid://2wibfnu2jvlv"]
[gd_scene load_steps=36 format=4 uid="uid://2wibfnu2jvlv"]
[ext_resource type="Texture2D" uid="uid://csj3kjwyn3s2u" path="res://src/enemy/enemy_types/horse_head/HORSE-FACE 1_Metal054C_1K-JPG_Color.jpg" id="1_56gxx"]
[ext_resource type="Script" path="res://src/boss/Boss.cs" id="1_hjyt5"]
@@ -10,10 +10,10 @@
script = ExtResource("2_o3rh6")
CurrentHP = 80.0
MaximumHP = 80.0
CurrentAttack = 0
CurrentAttack = 20
CurrentDefense = 0
MaxAttack = 0
MaxDefense = 0
MaxAttack = 20
MaxDefense = 3
Luck = 0.05
TelluricResistance = 0.0
AeolicResistance = 0.0
@@ -425,6 +425,18 @@ tracks/33/path = NodePath("Armature/Skeleton3D:heelIK_R")
tracks/33/interp = 1
tracks/33/loop_wrap = true
tracks/33/keys = PackedFloat32Array(0, 1, -0.514417, -0.701671, 0.342235, 0.354835, 0.0333333, 1, -0.516575, -0.696077, 0.34818, 0.356928, 0.0666667, 1, -0.521046, -0.683648, 0.361099, 0.361585, 0.1, 1, -0.526802, -0.665825, 0.378966, 0.368161, 0.133333, 1, -0.532831, -0.644142, 0.399731, 0.376016, 0.166667, 1, -0.538235, -0.620345, 0.421387, 0.384587, 0.2, 1, -0.541623, -0.598138, 0.440584, 0.393398, 0.233333, 1, -0.543484, -0.578544, 0.457025, 0.401298, 0.266667, 1, -0.544416, -0.56113, 0.47147, 0.407996, 0.3, 1, -0.544778, -0.545632, 0.484336, 0.413427, 0.333333, 1, -0.544721, -0.531989, 0.495718, 0.417767, 0.366667, 1, -0.544377, -0.520646, 0.505311, 0.421002, 0.4, 1, -0.543924, -0.510791, 0.513622, 0.423594, 0.433333, 1, -0.543459, -0.502293, 0.520716, 0.425687, 0.466667, 1, -0.543068, -0.495006, 0.52665, 0.427418, 0.5, 1, -0.542828, -0.488779, 0.531472, 0.428917, 0.533333, 1, -0.542927, -0.483649, 0.534893, 0.430352, 0.566667, 1, -0.543361, -0.479085, 0.537304, 0.431904, 0.6, 1, -0.544186, -0.474919, 0.538729, 0.433686, 0.633333, 1, -0.545455, -0.470982, 0.539193, 0.435806, 0.666667, 1, -0.547213, -0.467098, 0.538712, 0.438368, 0.7, 1, -0.549718, -0.46294, 0.537006, 0.441725, 0.733333, 1, -0.552835, -0.458304, 0.534392, 0.445821, 0.766667, 1, -0.556593, -0.453005, 0.530871, 0.450742, 0.8, 1, -0.561009, -0.446855, 0.526438, 0.456567, 0.833333, 1, -0.566094, -0.43966, 0.521083, 0.463367, 0.866667, 1, -0.574512, -0.428383, 0.511969, 0.473617, 0.9, 1, -0.580739, -0.420013, 0.504981, 0.480963, 0.933333, 1, -0.583481, -0.416308, 0.501836, 0.484146, 1.5, 1, -0.583481, -0.416308, 0.501836, 0.484147, 1.53333, 1, -0.586926, -0.412707, 0.504724, 0.480046, 1.56667, 1, -0.593849, -0.405313, 0.510547, 0.4716, 1.6, 1, -0.602537, -0.395719, 0.517887, 0.460596, 1.63333, 1, -0.611371, -0.385577, 0.525409, 0.44889, 1.66667, 1, -0.618875, -0.376627, 0.531899, 0.43844, 1.7, 1, -0.62194, -0.372867, 0.534831, 0.433723, 1.73333, 1, -0.621975, -0.376239, 0.534019, 0.431758, 1.76667, 1, -0.620122, -0.387062, 0.529695, 0.430181, 1.8, 1, -0.616869, -0.404941, 0.52204, 0.42775, 1.83333, 1, -0.61211, -0.428794, 0.511234, 0.424379, 1.86667, 1, -0.605462, -0.458552, 0.496893, 0.419813, 1.9, 1, -0.597286, -0.490892, 0.480276, 0.414256, 1.93333, 1, -0.587653, -0.524555, 0.461789, 0.407745, 2, 1, -0.564883, -0.591093, 0.421348, 0.392406, 2.03333, 1, -0.552901, -0.620859, 0.401387, 0.384349, 2.06667, 1, -0.54137, -0.646947, 0.382828, 0.376592, 2.1, 1, -0.530904, -0.668795, 0.366451, 0.36955, 2.13333, 1, -0.522132, -0.685942, 0.353021, 0.363646, 2.16667, 1, -0.515661, -0.697975, 0.34327, 0.359292, 2.2, 1, -0.513299, -0.702245, 0.339742, 0.357704, 2.20833, 1, -0.512705, -0.703308, 0.338857, 0.357304)
tracks/34/type = "value"
tracks/34/imported = false
tracks/34/enabled = true
tracks/34/path = NodePath("SecondaryAttackBox/CollisionShape3D:disabled")
tracks/34/interp = 1
tracks/34/loop_wrap = true
tracks/34/keys = {
"times": PackedFloat32Array(0, 0.933333, 1.06667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [true, false, true]
}
[sub_resource type="Animation" id="Animation_dbceu"]
resource_name = "IDLE"
@@ -1153,13 +1165,53 @@ tracks/33/path = NodePath("Armature/Skeleton3D:heelIK_R")
tracks/33/interp = 0
tracks/33/loop_wrap = true
tracks/33/keys = PackedFloat32Array(0, 1, -0.514417, -0.701671, 0.342235, 0.354835)
tracks/34/type = "value"
tracks/34/imported = false
tracks/34/enabled = true
tracks/34/path = NodePath("AttackBox/CollisionShape3D:disabled")
tracks/34/interp = 1
tracks/34/loop_wrap = true
tracks/34/keys = {
"times": PackedFloat32Array(0, 0.366667, 0.466667, 0.9, 0.933333),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [true, false, true, false, true]
}
[sub_resource type="Animation" id="Animation_858f7"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("AttackBox/CollisionShape3D:disabled")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("SecondaryAttackBox/CollisionShape3D:disabled")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_485f6"]
_data = {
&"SecondaryAttack": SubResource("Animation_h0cfj"),
&"Idle": SubResource("Animation_dbceu"),
&"Walk": SubResource("Animation_7am3g"),
&"PrimaryAttack": SubResource("Animation_gbusp")
"Idle": SubResource("Animation_dbceu"),
"PrimaryAttack": SubResource("Animation_gbusp"),
"RESET": SubResource("Animation_858f7"),
"SecondaryAttack": SubResource("Animation_h0cfj"),
"Walk": SubResource("Animation_7am3g")
}
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_wa3i1"]
@@ -1294,11 +1346,14 @@ tracks/1/keys = {
[sub_resource type="AnimationLibrary" id="AnimationLibrary_nod6b"]
_data = {
&"Hit": SubResource("Animation_q24il"),
&"RESET": SubResource("Animation_xhb0i"),
&"Defeated": SubResource("Animation_7g8kc")
"Defeated": SubResource("Animation_7g8kc"),
"Hit": SubResource("Animation_q24il"),
"RESET": SubResource("Animation_xhb0i")
}
[sub_resource type="BoxShape3D" id="BoxShape3D_ib47f"]
size = Vector3(17.7339, 22.0363, 19.9701)
[node name="HorseFace" type="CharacterBody3D"]
transform = Transform3D(0.15, 0, 0, 0, 0.15, 0, 0, 0, 0.15, 0, 0, 0)
axis_lock_linear_y = true
@@ -1317,7 +1372,7 @@ bones/0/name = "spine1"
bones/0/parent = -1
bones/0/rest = Transform3D(1.49012e-06, 0.00846654, -0.999964, 2.93367e-08, 0.999964, 0.00846654, 1, -4.23752e-08, 1.49012e-06, 0.000155807, -0.00105953, -2.01735)
bones/0/enabled = true
bones/0/position = Vector3(0.0996386, -0.409772, -1.53144)
bones/0/position = Vector3(0.0996386, -0.273442, -1.53144)
bones/0/rotation = Quaternion(0.0256267, -0.805691, 0.0118477, 0.591662)
bones/0/scale = Vector3(1, 1, 1)
bones/1/name = "spine0"
@@ -1346,7 +1401,7 @@ bones/4/parent = 3
bones/4/rest = Transform3D(0.901905, -0.410135, 0.135488, 0.412416, 0.910915, 0.0120912, -0.128377, 0.0449723, 0.990705, 2.5332e-07, 0.990515, -7.07805e-08)
bones/4/enabled = true
bones/4/position = Vector3(2.5332e-07, 0.990515, -7.07805e-08)
bones/4/rotation = Quaternion(-0.00408793, 0.0603897, 0.187587, 0.980381)
bones/4/rotation = Quaternion(0.0084299, 0.0676487, 0.210882, 0.975132)
bones/4/scale = Vector3(1, 1, 1)
bones/5/name = "neck4"
bones/5/parent = 4
@@ -1360,7 +1415,7 @@ bones/6/parent = 5
bones/6/rest = Transform3D(0.0598389, 0.98531, 0.15995, -0.975271, 0.0235553, 0.219755, 0.212759, -0.169144, 0.962353, 3.65078e-07, 1.40318, 0)
bones/6/enabled = true
bones/6/position = Vector3(3.65078e-07, 1.40318, 0)
bones/6/rotation = Quaternion(-0.329769, 0.050846, -0.457357, 0.824313)
bones/6/rotation = Quaternion(-0.343621, 0.0521605, -0.496465, 0.795441)
bones/6/scale = Vector3(1, 1, 1)
bones/7/name = "Bone.007"
bones/7/parent = 6
@@ -1395,7 +1450,7 @@ bones/11/parent = 1
bones/11/rest = Transform3D(0.981457, 0.0769315, -0.175568, 0.18837, -0.217537, 0.957703, 0.035485, -0.973015, -0.227995, -1.09896e-07, 3.84743, -2.10479e-07)
bones/11/enabled = true
bones/11/position = Vector3(-1.09896e-07, 3.84743, -2.10479e-07)
bones/11/rotation = Quaternion(-0.813133, -0.0929118, -0.0237927, 0.574122)
bones/11/rotation = Quaternion(-0.805738, -0.0791136, -0.0234744, 0.586495)
bones/11/scale = Vector3(1, 1, 1)
bones/12/name = "arm2_L"
bones/12/parent = 11
@@ -1422,7 +1477,7 @@ bones/15/name = "arm1_R"
bones/15/parent = 1
bones/15/rest = Transform3D(-0.98213, 0.0512573, -0.181089, -0.187541, -0.185921, 0.964501, 0.0157694, 0.981227, 0.192212, 0.00107862, 3.8461, -0.0821097)
bones/15/enabled = true
bones/15/position = Vector3(-0.174128, 3.43196, 0.116912)
bones/15/position = Vector3(-0.203939, 3.66122, 0.0735636)
bones/15/rotation = Quaternion(-0.502686, 0.531044, 0.680821, -0.0422068)
bones/15/scale = Vector3(1, 1, 1)
bones/16/name = "arm2_R"
@@ -1437,7 +1492,7 @@ bones/17/parent = 16
bones/17/rest = Transform3D(0.998789, 0.0488077, -0.00615137, -0.0491113, 0.996528, -0.0672226, 0.00284903, 0.0674433, 0.997719, -5.21541e-08, 3.04263, -1.31503e-06)
bones/17/enabled = true
bones/17/position = Vector3(-5.21541e-08, 3.04263, -1.31503e-06)
bones/17/rotation = Quaternion(-0.0138979, 0.0962523, 0.276071, 0.956205)
bones/17/rotation = Quaternion(-0.0474455, 0.0974058, 0.264379, 0.958314)
bones/17/scale = Vector3(1, 1, 1)
bones/18/name = "hand_R"
bones/18/parent = 17
@@ -1450,7 +1505,7 @@ bones/19/name = "hip_L"
bones/19/parent = -1
bones/19/rest = Transform3D(0.138486, 0.897208, 0.419333, -0.129033, -0.403458, 0.905854, 0.981923, -0.179556, 0.059896, 0.000155807, -0.00105953, -2.01735)
bones/19/enabled = true
bones/19/position = Vector3(0.147751, -0.357642, -1.49267)
bones/19/position = Vector3(0.147751, -0.278747, -1.49267)
bones/19/rotation = Quaternion(0.427793, 0.34021, 0.687061, -0.478745)
bones/19/scale = Vector3(1, 1, 1)
bones/20/name = "leg1_L"
@@ -1458,14 +1513,14 @@ bones/20/parent = 19
bones/20/rest = Transform3D(0.945603, 0.113405, 0.304916, -0.324072, 0.410457, 0.852351, -0.0284943, -0.9048, 0.424881, 2.08616e-07, 2.00996, -7.1153e-07)
bones/20/enabled = true
bones/20/position = Vector3(2.08616e-07, 2.00996, -7.1153e-07)
bones/20/rotation = Quaternion(-0.43401, -0.329966, -0.375157, 0.749677)
bones/20/rotation = Quaternion(-0.438005, -0.325012, -0.369045, 0.752546)
bones/20/scale = Vector3(1, 1, 1)
bones/21/name = "leg2_L"
bones/21/parent = 20
bones/21/rest = Transform3D(0.990336, -0.138679, 0.00180777, 0.138628, 0.990193, 0.0173138, -0.00419111, -0.0168959, 0.999848, 5.96046e-08, 5.85994, -5.23403e-07)
bones/21/enabled = true
bones/21/position = Vector3(5.96046e-08, 5.85994, -5.23403e-07)
bones/21/rotation = Quaternion(-0.0491798, 0.00187834, 0.393393, 0.918052)
bones/21/rotation = Quaternion(-0.047416, 0.00189064, 0.379284, 0.924063)
bones/21/scale = Vector3(1, 1, 1)
bones/22/name = "foot1_L"
bones/22/parent = 21
@@ -1499,7 +1554,7 @@ bones/26/name = "hip_R"
bones/26/parent = -1
bones/26/rest = Transform3D(0.138486, -0.897208, -0.419333, 0.129033, -0.403458, 0.905854, -0.981923, -0.179556, 0.059896, -0.000155807, -0.00105953, -2.01735)
bones/26/enabled = true
bones/26/position = Vector3(0.0289172, -0.348385, -1.59603)
bones/26/position = Vector3(0.0289172, -0.295789, -1.59603)
bones/26/rotation = Quaternion(0.695067, -0.09936, -0.377924, -0.603475)
bones/26/scale = Vector3(1, 1, 1)
bones/27/name = "leg1_R"
@@ -1507,14 +1562,14 @@ bones/27/parent = 26
bones/27/rest = Transform3D(0.945603, -0.113405, -0.304916, 0.324072, 0.410457, 0.852351, 0.0284943, -0.9048, 0.424881, -9.54606e-09, 2.00996, -3.52971e-07)
bones/27/enabled = true
bones/27/position = Vector3(-9.54606e-09, 2.00996, -3.52971e-07)
bones/27/rotation = Quaternion(-0.311741, 0.178218, 0.184298, 0.914926)
bones/27/rotation = Quaternion(-0.317991, 0.173749, 0.183858, 0.913723)
bones/27/scale = Vector3(1, 1, 1)
bones/28/name = "leg2_R"
bones/28/parent = 27
bones/28/rest = Transform3D(0.990336, 0.138679, -0.00180777, -0.138628, 0.990193, 0.0173138, 0.00419111, -0.0168959, 0.999848, 4.51691e-08, 5.85994, -3.72529e-09)
bones/28/enabled = true
bones/28/position = Vector3(4.51691e-08, 5.85994, -3.72529e-09)
bones/28/rotation = Quaternion(-0.277098, 0.0201429, -0.180803, 0.943462)
bones/28/rotation = Quaternion(-0.267474, 0.0202273, -0.174523, 0.947412)
bones/28/scale = Vector3(1, 1, 1)
bones/29/name = "foot1_R"
bones/29/parent = 28
@@ -1550,7 +1605,7 @@ mesh = SubResource("ArrayMesh_007gq")
skin = SubResource("Skin_vjpvu")
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="Armature/Skeleton3D"]
transform = Transform3D(-0.370164, -0.13327, -0.919357, -0.296918, -0.92077, 0.253024, -0.880238, 0.366634, 0.301266, -2.00357, 8.73106, 6.30238)
transform = Transform3D(-0.370164, -0.13327, -0.919357, -0.256758, -0.936427, 0.239124, -0.892779, 0.324567, 0.312413, -2.00357, 8.78726, 6.13288)
bone_name = "TOP OF SKULL"
bone_idx = 8
@@ -1563,7 +1618,7 @@ omni_attenuation = 0.167
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
&"": SubResource("AnimationLibrary_485f6")
"": SubResource("AnimationLibrary_485f6")
}
[node name="AnimationTree" type="AnimationTree" parent="."]
@@ -1588,5 +1643,25 @@ shape = SubResource("BoxShape3D_bhe2v")
[node name="HitAnimation" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
libraries = {
&"": SubResource("AnimationLibrary_nod6b")
"": SubResource("AnimationLibrary_nod6b")
}
[node name="AttackBox" type="Area3D" parent="."]
unique_name_in_owner = true
collision_layer = 64
collision_mask = 64
[node name="CollisionShape3D" type="CollisionShape3D" parent="AttackBox"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.541749, 9.35548, 9.48504)
shape = SubResource("BoxShape3D_ib47f")
disabled = true
[node name="SecondaryAttackBox" type="Area3D" parent="."]
unique_name_in_owner = true
collision_layer = 64
collision_mask = 64
[node name="CollisionShape3D" type="CollisionShape3D" parent="SecondaryAttackBox"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.541749, 9.35548, 9.48504)
shape = SubResource("BoxShape3D_ib47f")
disabled = true

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=32 format=4 uid="uid://6dnsw37d1uw4"]
[gd_scene load_steps=33 format=4 uid="uid://6dnsw37d1uw4"]
[ext_resource type="Texture2D" uid="uid://dp6hwvuhfkji8" path="res://src/enemy/enemy_types/ox_face/models/OX FACE_Metal054C_1K-JPG_Color.jpg" id="1_iwcva"]
[ext_resource type="Script" path="res://src/boss/Boss.cs" id="1_xakg1"]
@@ -11,10 +11,10 @@
script = ExtResource("2_hdr5w")
CurrentHP = 80.0
MaximumHP = 80.0
CurrentAttack = 0
CurrentDefense = 0
MaxAttack = 0
MaxDefense = 0
CurrentAttack = 20
CurrentDefense = 3
MaxAttack = 20
MaxDefense = 3
Luck = 0.05
TelluricResistance = 0.0
AeolicResistance = 0.0
@@ -309,6 +309,9 @@ _data = {
[sub_resource type="BoxShape3D" id="BoxShape3D_hcxtl"]
size = Vector3(14.6793, 34.6932, 15.6199)
[sub_resource type="BoxShape3D" id="BoxShape3D_afp5i"]
size = Vector3(17.7339, 22.0363, 19.9701)
[node name="OX FACE" type="CharacterBody3D"]
transform = Transform3D(0.15, 0, 0, 0, 0.15, 0, 0, 0, 0.15, 0, -1, 0)
axis_lock_linear_y = true
@@ -327,7 +330,7 @@ bones/0/name = "spine1"
bones/0/parent = -1
bones/0/rest = Transform3D(1.49012e-06, 0.00846654, -0.999964, 2.93367e-08, 0.999964, 0.00846654, 1, -4.23752e-08, 1.49012e-06, 0.000155807, -0.00105953, -2.01735)
bones/0/enabled = true
bones/0/position = Vector3(-0.260202, -1.04547, -1.96826)
bones/0/position = Vector3(-0.259283, -0.9404, -1.97534)
bones/0/rotation = Quaternion(0.0915277, -0.692111, -0.0341586, 0.715149)
bones/0/scale = Vector3(1, 1, 1)
bones/1/name = "spine0"
@@ -370,7 +373,7 @@ bones/6/parent = 5
bones/6/rest = Transform3D(0.0598389, 0.98531, 0.15995, -0.975271, 0.0235553, 0.219755, 0.212759, -0.169144, 0.962353, 3.65078e-07, 1.40318, 0)
bones/6/enabled = true
bones/6/position = Vector3(3.65078e-07, 1.40318, 0)
bones/6/rotation = Quaternion(-0.0475432, -0.294218, -0.744152, 0.59784)
bones/6/rotation = Quaternion(-0.0777813, -0.305234, -0.744803, 0.58826)
bones/6/scale = Vector3(1, 1, 1)
bones/7/name = "Bone.007"
bones/7/parent = 6
@@ -405,7 +408,7 @@ bones/11/parent = 1
bones/11/rest = Transform3D(0.981457, 0.0769315, -0.175568, 0.18837, -0.217537, 0.957703, 0.035485, -0.973015, -0.227995, -1.09896e-07, 3.84743, -2.10479e-07)
bones/11/enabled = true
bones/11/position = Vector3(-1.09896e-07, 3.84743, -2.10479e-07)
bones/11/rotation = Quaternion(-0.779914, -0.0574383, 0.0814382, 0.617902)
bones/11/rotation = Quaternion(-0.786087, -0.0628615, 0.0690646, 0.61102)
bones/11/scale = Vector3(1, 0.999999, 1)
bones/12/name = "arm2_L"
bones/12/parent = 11
@@ -433,21 +436,21 @@ bones/15/parent = 1
bones/15/rest = Transform3D(-0.98213, 0.0512573, -0.181089, -0.187541, -0.185921, 0.964501, 0.0157694, 0.981227, 0.192212, 0.00107862, 3.8461, -0.0821097)
bones/15/enabled = true
bones/15/position = Vector3(0.00107886, 3.8461, -0.0821095)
bones/15/rotation = Quaternion(-0.215121, 0.74481, 0.614114, -0.1478)
bones/15/rotation = Quaternion(-0.209386, 0.735858, 0.623768, -0.15995)
bones/15/scale = Vector3(1, 1, 1)
bones/16/name = "arm2_R"
bones/16/parent = 15
bones/16/rest = Transform3D(0.999962, -0.00846545, 0.00203661, 0.00853768, 0.99922, -0.0385481, -0.0017087, 0.038564, 0.999254, -4.28408e-07, 3.65838, -2.16067e-06)
bones/16/enabled = true
bones/16/position = Vector3(-4.28408e-07, 3.65838, -2.16067e-06)
bones/16/rotation = Quaternion(-0.486067, -0.16412, -0.362283, 0.778174)
bones/16/rotation = Quaternion(-0.424022, 0.233298, -0.489444, 0.725412)
bones/16/scale = Vector3(1, 1, 0.999999)
bones/17/name = "arm3_R"
bones/17/parent = 16
bones/17/rest = Transform3D(0.998789, 0.0488077, -0.00615137, -0.0491113, 0.996528, -0.0672226, 0.00284903, 0.0674433, 0.997719, -5.21541e-08, 3.04263, -1.31503e-06)
bones/17/enabled = true
bones/17/position = Vector3(-5.21541e-08, 3.04263, -1.31503e-06)
bones/17/rotation = Quaternion(-0.0553629, -0.0361614, 0.62832, 0.77514)
bones/17/rotation = Quaternion(-0.0553628, -0.0361614, 0.62832, 0.77514)
bones/17/scale = Vector3(1, 0.999999, 1)
bones/18/name = "hand_R"
bones/18/parent = 17
@@ -460,22 +463,22 @@ bones/19/name = "hip_L"
bones/19/parent = -1
bones/19/rest = Transform3D(0.138486, 0.897208, 0.419333, -0.129033, -0.403458, 0.905854, 0.981923, -0.179556, 0.059896, 0.000155807, -0.00105953, -2.01735)
bones/19/enabled = true
bones/19/position = Vector3(-0.374785, -1.194, -1.73853)
bones/19/rotation = Quaternion(0.626407, 0.294406, 0.547288, -0.470548)
bones/19/position = Vector3(-0.290163, -1.11395, -2.01735)
bones/19/rotation = Quaternion(0.608697, 0.3155, 0.575514, -0.445793)
bones/19/scale = Vector3(1, 1, 1)
bones/20/name = "leg1_L"
bones/20/parent = 19
bones/20/rest = Transform3D(0.945603, 0.113405, 0.304916, -0.324072, 0.410457, 0.852351, -0.0284943, -0.9048, 0.424881, 2.08616e-07, 2.00996, -7.1153e-07)
bones/20/enabled = true
bones/20/position = Vector3(2.08616e-07, 2.00996, -7.1153e-07)
bones/20/rotation = Quaternion(-0.326486, -0.424244, -0.298458, 0.790156)
bones/20/rotation = Quaternion(-0.30808, -0.444485, -0.267974, 0.797314)
bones/20/scale = Vector3(1, 0.999999, 1)
bones/21/name = "leg2_L"
bones/21/parent = 20
bones/21/rest = Transform3D(0.990336, -0.138679, 0.00180777, 0.138628, 0.990193, 0.0173138, -0.00419111, -0.0168959, 0.999848, 5.96046e-08, 5.85994, -5.23403e-07)
bones/21/enabled = true
bones/21/position = Vector3(5.96046e-08, 5.85994, -5.23403e-07)
bones/21/rotation = Quaternion(-0.0604731, 0.00129853, 0.489531, 0.869885)
bones/21/rotation = Quaternion(-0.060049, 0.00130142, 0.4861, 0.871837)
bones/21/scale = Vector3(1, 1, 1)
bones/22/name = "foot1_L"
bones/22/parent = 21
@@ -509,7 +512,7 @@ bones/26/name = "hip_R"
bones/26/parent = -1
bones/26/rest = Transform3D(0.138486, -0.897208, -0.419333, 0.129033, -0.403458, 0.905854, -0.981923, -0.179556, 0.059896, -0.000155807, -0.00105953, -2.01735)
bones/26/enabled = true
bones/26/position = Vector3(-0.0417459, -1.11395, -2.01905)
bones/26/position = Vector3(-0.290475, -1.11395, -2.01735)
bones/26/rotation = Quaternion(0.608697, -0.3155, -0.575514, -0.445793)
bones/26/scale = Vector3(1, 1, 1)
bones/27/name = "leg1_R"
@@ -517,14 +520,14 @@ bones/27/parent = 26
bones/27/rest = Transform3D(0.945603, -0.113405, -0.304916, 0.324072, 0.410457, 0.852351, 0.0284943, -0.9048, 0.424881, -9.54606e-09, 2.00996, -3.52971e-07)
bones/27/enabled = true
bones/27/position = Vector3(-9.54606e-09, 2.00996, -3.52971e-07)
bones/27/rotation = Quaternion(-0.202464, 0.424548, 0.138115, 0.871603)
bones/27/rotation = Quaternion(-0.209385, 0.420724, 0.143017, 0.871031)
bones/27/scale = Vector3(1, 0.999999, 1)
bones/28/name = "leg2_R"
bones/28/parent = 27
bones/28/rest = Transform3D(0.990336, 0.138679, -0.00180777, -0.138628, 0.990193, 0.0173138, 0.00419111, -0.0168959, 0.999848, 4.51691e-08, 5.85994, -3.72529e-09)
bones/28/enabled = true
bones/28/position = Vector3(4.51691e-08, 5.85994, -3.72529e-09)
bones/28/rotation = Quaternion(-0.0628203, -0.00116421, -0.501551, 0.862843)
bones/28/rotation = Quaternion(-0.0643786, -0.00115414, -0.513993, 0.855374)
bones/28/scale = Vector3(1, 1, 1)
bones/29/name = "foot1_R"
bones/29/parent = 28
@@ -556,7 +559,7 @@ bones/32/rotation = Quaternion(0.456756, 0.539878, -0.539587, -0.456893)
bones/32/scale = Vector3(1, 1, 1)
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="Armature/Skeleton3D"]
transform = Transform3D(-0.266304, -0.0360179, -0.963216, -0.333717, -0.934053, 0.127191, -0.904275, 0.355314, 0.236722, -1.68937, 8.20828, 4.95637)
transform = Transform3D(-0.300929, -0.0901167, -0.949379, -0.328078, -0.924976, 0.191792, -0.895436, 0.369186, 0.248787, -1.6582, 8.32712, 4.94593)
bone_name = "TOP OF SKULL"
bone_idx = 8
@@ -600,3 +603,23 @@ collision_mask = 16
[node name="CollisionShape3D" type="CollisionShape3D" parent="Hitbox"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.300452, 16.3466, 2.703)
shape = SubResource("BoxShape3D_hcxtl")
[node name="AttackBox" type="Area3D" parent="."]
unique_name_in_owner = true
collision_layer = 64
collision_mask = 64
[node name="CollisionShape3D" type="CollisionShape3D" parent="AttackBox"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.541749, 9.35548, 9.48504)
shape = SubResource("BoxShape3D_afp5i")
disabled = true
[node name="SecondaryAttackBox" type="Area3D" parent="."]
unique_name_in_owner = true
collision_layer = 64
collision_mask = 64
[node name="CollisionShape3D" type="CollisionShape3D" parent="SecondaryAttackBox"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.541749, 9.35548, 9.48504)
shape = SubResource("BoxShape3D_afp5i")
disabled = true

View File

@@ -16,6 +16,8 @@ namespace GameJamDungeon
public float GetRightStrafeInputVector();
public void ApplyCentralImpulseToPlayer(Vector3 velocity);
event Player.InventoryButtonPressedEventHandler InventoryButtonPressed;
event Player.MinimapButtonHeldEventHandler MinimapButtonHeld;
event Player.PauseButtonPressedEventHandler PauseButtonPressed;
@@ -71,6 +73,9 @@ namespace GameJamDungeon
private bool reduceOnTick = true;
private float _knockbackStrength = 0.0f;
private Vector3 _knockbackDirection = Vector3.Zero;
public void Initialize()
{
AnimationPlayer.AnimationFinished += OnAnimationFinished;
@@ -121,8 +126,10 @@ namespace GameJamDungeon
PlayerBinding
.Handle((in PlayerLogic.Output.MovementComputed output) =>
{
_knockbackStrength = _knockbackStrength * 0.9f;
Transform = Transform with { Basis = output.Rotation };
Velocity = output.Velocity;
Velocity = output.Velocity + (_knockbackDirection * _knockbackStrength);
MoveAndSlide();
})
.Handle((in PlayerLogic.Output.Animations.Attack output) =>
{
@@ -184,7 +191,6 @@ namespace GameJamDungeon
PlayerLogic.Input(new PlayerLogic.Input.PhysicsTick(delta));
SwordSlashAnimation.Position = GetViewport().GetVisibleRect().Size / 2;
MoveAndSlide();
PlayerLogic.Input(new PlayerLogic.Input.Moved(GlobalPosition, GlobalTransform));
}
@@ -221,6 +227,12 @@ namespace GameJamDungeon
throwItem.GlobalRotation = GlobalRotation;
}
public void ApplyCentralImpulseToPlayer(Vector3 velocity)
{
_knockbackStrength = 115.0f;
_knockbackDirection = velocity;
}
public void OnAnimationFinished(StringName animation)
{
GD.Print("Attack finished");