feat: implemented enemy wretched attack animation and damage boxes
This commit is contained in:
parent
a0c143d3b5
commit
fb9417a1d8
|
@ -13,7 +13,7 @@ void DamageBox::attack_motion_begin() {
|
|||
|
||||
void DamageBox::attack_motion_end() {
|
||||
this->already_hit.clear();
|
||||
set_monitoring(true);
|
||||
set_monitoring(false);
|
||||
}
|
||||
|
||||
void DamageBox::on_body_entered(Node3D *node) {
|
||||
|
@ -34,6 +34,8 @@ void DamageBox::_notification(int what) {
|
|||
return;
|
||||
case NOTIFICATION_ENTER_TREE:
|
||||
connect("body_entered", callable_mp(this, &self_type::on_body_entered));
|
||||
connect("area_entered", callable_mp(this, &self_type::on_body_entered));
|
||||
set_monitoring(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
74
project/assets/models/enemies/model_scenes/wretched.tscn
Normal file
74
project/assets/models/enemies/model_scenes/wretched.tscn
Normal file
|
@ -0,0 +1,74 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://crtgy2rph5to2"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ho7wwawj6s65" path="res://assets/models/enemies/wretched.blend" id="1_w0sx6"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_w0sx6"]
|
||||
size = Vector3(0.35351563, 0.8721161, 0.29003906)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_a12c4"]
|
||||
size = Vector3(0.37524414, 0.64245605, 0.38867188)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_2le77"]
|
||||
size = Vector3(0.24902344, 0.42858887, 0.2619629)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_yvqru"]
|
||||
size = Vector3(0.86776733, 0.107666016, 0.11816406)
|
||||
|
||||
[node name="wretched" instance=ExtResource("1_w0sx6")]
|
||||
|
||||
[node name="Hitbox" type="Hitbox" parent="Character/Skeleton3D" index="2"]
|
||||
transform = Transform3D(1, 2.1910389e-16, -2.2202524e-16, -2.2202514e-16, 0.9999124, -0.013243958, 2.1910394e-16, 0.01324396, 0.9999123, 6.209e-17, 0.097789526, 0.004007945)
|
||||
collision_layer = 6
|
||||
collision_mask = 0
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape3D2" type="CollisionShape3D" parent="Character/Skeleton3D/Hitbox" index="0"]
|
||||
transform = Transform3D(1, 5.875464e-21, 0, 6.2038546e-25, 1.0000037, 0, 0, 0, 1.0000037, -2.2362435e-16, 0.35283393, -0.013339132)
|
||||
shape = SubResource("BoxShape3D_w0sx6")
|
||||
|
||||
[node name="SpineAttach" type="BoneAttachment3D" parent="Character/Skeleton3D" index="3"]
|
||||
transform = Transform3D(1, -2.2202518e-16, 2.1910394e-16, 2.1910388e-16, 0.9999122, 0.013243955, -2.220252e-16, -0.0132439565, 0.99991226, -4.1256417e-17, 1.1546816, -0.0027124744)
|
||||
bone_name = "spine.002"
|
||||
bone_idx = 3
|
||||
|
||||
[node name="Hitbox" type="Hitbox" parent="Character/Skeleton3D/SpineAttach" index="0"]
|
||||
transform = Transform3D(1, 2.1910389e-16, -2.2202524e-16, -2.2202514e-16, 0.9999124, -0.013243958, 2.1910394e-16, 0.01324396, 0.9999123, -2.1234107e-16, -1.1546164, -0.012580322)
|
||||
collision_layer = 4
|
||||
collision_mask = 0
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Character/Skeleton3D/SpineAttach/Hitbox" index="0"]
|
||||
transform = Transform3D(1, -2.2202515e-16, 2.1910396e-16, 2.1910385e-16, 0.9999122, 0.0132439565, -2.2202522e-16, -0.013243958, 0.99991226, 0.0023498535, 1.1967317, -0.0032694251)
|
||||
shape = SubResource("BoxShape3D_a12c4")
|
||||
|
||||
[node name="HeadAttach" type="BoneAttachment3D" parent="Character/Skeleton3D" index="4"]
|
||||
transform = Transform3D(0.9999988, -0.0007823897, 0.0013344375, 0.0007271601, 0.99916273, 0.040897816, -0.0013653187, -0.040896796, 0.9991622, -1.3069549e-16, 1.5574794, -0.0040687313)
|
||||
bone_name = "Neck"
|
||||
bone_idx = 5
|
||||
|
||||
[node name="Hitbox" type="Hitbox" parent="Character/Skeleton3D/HeadAttach" index="0"]
|
||||
transform = Transform3D(1, 2.1910389e-16, -2.2202524e-16, -2.2202514e-16, 0.9999124, -0.013243958, 2.1910394e-16, 0.01324396, 0.9999123, -2.1234107e-16, -1.1546164, -0.012580322)
|
||||
collision_layer = 4
|
||||
collision_mask = 0
|
||||
monitoring = false
|
||||
damage_modifier = 2.0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Character/Skeleton3D/HeadAttach/Hitbox" index="0"]
|
||||
transform = Transform3D(1, -2.2202515e-16, 2.1910393e-16, 2.1910723e-16, 0.9999161, 0.013243863, -2.2202641e-16, -0.013243858, 0.9999161, -7.644832e-17, 1.3035276, -0.01432839)
|
||||
shape = SubResource("BoxShape3D_2le77")
|
||||
|
||||
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="Character/Skeleton3D" index="5"]
|
||||
transform = Transform3D(0.10797773, -0.79005337, 0.60345376, 0.4003794, 0.5901581, 0.70100564, -0.9099653, 0.16591746, 0.38004512, 0.28507733, 1.5014915, -0.21731633)
|
||||
bone_name = "hand.R"
|
||||
bone_idx = 9
|
||||
|
||||
[node name="DamageBox" type="DamageBox" parent="Character/Skeleton3D/BoneAttachment3D" index="0"]
|
||||
transform = Transform3D(0.8168715, 0.42058483, 0.39475223, -0.47940335, 0.87559944, 0.059143633, -0.32076997, -0.2375583, 0.91688204, -0.0065350886, 0.06456717, -0.0151789)
|
||||
collision_layer = 0
|
||||
collision_mask = 8
|
||||
monitoring = false
|
||||
monitorable = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Character/Skeleton3D/BoneAttachment3D/DamageBox" index="0"]
|
||||
transform = Transform3D(1, -1.1175919e-06, -1.7881156e-06, 1.1175778e-06, 1, -7.912447e-06, 1.7881245e-06, 7.912445e-06, 1, -0.20445287, -3.5762787e-07, -2.682209e-07)
|
||||
shape = SubResource("BoxShape3D_yvqru")
|
|
@ -414,3 +414,11 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.44426918, -0.0014839172, -1
|
|||
[node name="NpcUnit" parent="." node_paths=PackedStringArray("patrol_path") instance=ExtResource("3_7ng1a")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.6569076, -9.536743e-07, 13.002816)
|
||||
patrol_path = NodePath("../PatrolPath")
|
||||
|
||||
[node name="NpcUnit2" parent="." node_paths=PackedStringArray("patrol_path") instance=ExtResource("3_7ng1a")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15.306059, 9.536743e-07, -5.424572)
|
||||
patrol_path = NodePath("../PatrolPath")
|
||||
|
||||
[node name="NpcUnit3" parent="." node_paths=PackedStringArray("patrol_path") instance=ExtResource("3_7ng1a")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.691285, 9.536743e-07, -16.904852)
|
||||
patrol_path = NodePath("../PatrolPath")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://dqlqgk1veyos8"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dqlqgk1veyos8"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ho7wwawj6s65" path="res://assets/models/enemies/wretched.blend" id="2_ei3ai"]
|
||||
[ext_resource type="PackedScene" uid="uid://crtgy2rph5to2" path="res://assets/models/enemies/model_scenes/wretched.tscn" id="1_qot2n"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_qot2n"]
|
||||
script/source = "extends EnemyWretched
|
||||
|
@ -9,72 +9,21 @@ func _on_health_status_death() -> void:
|
|||
queue_free();
|
||||
"
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_qot2n"]
|
||||
size = Vector3(0.37524414, 0.64245605, 0.38867188)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_ei3ai"]
|
||||
size = Vector3(0.24902344, 0.42858887, 0.2619629)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_cpfor"]
|
||||
size = Vector3(0.32873535, 0.107666016, 0.11816406)
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ng1ul"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_sivli"]
|
||||
size = Vector3(0.35351563, 0.8721161, 0.29003906)
|
||||
|
||||
[node name="EnemyWretched" type="EnemyWretched"]
|
||||
script = SubResource("GDScript_qot2n")
|
||||
|
||||
[node name="wretched" parent="." instance=ExtResource("2_ei3ai")]
|
||||
[node name="wretched" parent="." instance=ExtResource("1_qot2n")]
|
||||
|
||||
[node name="SpineAttach" type="BoneAttachment3D" parent="wretched/Character/Skeleton3D" index="2"]
|
||||
transform = Transform3D(1, -2.2202518e-16, 2.1910394e-16, 2.1910388e-16, 0.9999122, 0.013243955, -2.220252e-16, -0.0132439565, 0.99991226, -4.1256417e-17, 1.1546816, -0.0027124744)
|
||||
bone_name = "spine.002"
|
||||
bone_idx = 3
|
||||
[node name="Hitbox" parent="wretched/Character/Skeleton3D" index="2" node_paths=PackedStringArray("health")]
|
||||
health = NodePath("../../../../HealthStatus")
|
||||
|
||||
[node name="Hitbox" type="Hitbox" parent="wretched/Character/Skeleton3D/SpineAttach" node_paths=PackedStringArray("health")]
|
||||
transform = Transform3D(1, 2.1910389e-16, -2.2202524e-16, -2.2202514e-16, 0.9999124, -0.013243958, 2.1910394e-16, 0.01324396, 0.9999123, -2.1234107e-16, -1.1546164, -0.012580322)
|
||||
collision_layer = 6
|
||||
collision_mask = 0
|
||||
monitoring = false
|
||||
[node name="Hitbox" parent="wretched/Character/Skeleton3D/SpineAttach" index="0" node_paths=PackedStringArray("health")]
|
||||
health = NodePath("../../../../../HealthStatus")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="wretched/Character/Skeleton3D/SpineAttach/Hitbox"]
|
||||
transform = Transform3D(1, -2.2202515e-16, 2.1910396e-16, 2.1910385e-16, 0.9999122, 0.0132439565, -2.2202522e-16, -0.013243958, 0.99991226, 0.0023498535, 1.1967317, -0.0032694251)
|
||||
shape = SubResource("BoxShape3D_qot2n")
|
||||
|
||||
[node name="HeadAttach" type="BoneAttachment3D" parent="wretched/Character/Skeleton3D" index="3"]
|
||||
transform = Transform3D(0.9999988, -0.0007823897, 0.0013344375, 0.0007271601, 0.99916273, 0.040897816, -0.0013653187, -0.040896796, 0.9991622, -1.3069549e-16, 1.5574794, -0.0040687313)
|
||||
bone_name = "Neck"
|
||||
bone_idx = 5
|
||||
|
||||
[node name="Hitbox" type="Hitbox" parent="wretched/Character/Skeleton3D/HeadAttach" node_paths=PackedStringArray("health")]
|
||||
transform = Transform3D(1, 2.1910389e-16, -2.2202524e-16, -2.2202514e-16, 0.9999124, -0.013243958, 2.1910394e-16, 0.01324396, 0.9999123, -2.1234107e-16, -1.1546164, -0.012580322)
|
||||
collision_layer = 6
|
||||
collision_mask = 0
|
||||
monitoring = false
|
||||
[node name="Hitbox" parent="wretched/Character/Skeleton3D/HeadAttach" index="0" node_paths=PackedStringArray("health")]
|
||||
health = NodePath("../../../../../HealthStatus")
|
||||
damage_modifier = 2.0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="wretched/Character/Skeleton3D/HeadAttach/Hitbox"]
|
||||
transform = Transform3D(1, -2.2202515e-16, 2.1910393e-16, 2.1910723e-16, 0.9999161, 0.013243863, -2.2202641e-16, -0.013243858, 0.9999161, -7.644832e-17, 1.3035276, -0.01432839)
|
||||
shape = SubResource("BoxShape3D_ei3ai")
|
||||
|
||||
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="wretched/Character/Skeleton3D" index="4"]
|
||||
transform = Transform3D(0.10797773, -0.79005337, 0.60345376, 0.4003794, 0.5901581, 0.70100564, -0.9099653, 0.16591746, 0.38004512, 0.28507733, 1.5014915, -0.21731633)
|
||||
bone_name = "hand.R"
|
||||
bone_idx = 9
|
||||
|
||||
[node name="Area3D" type="Area3D" parent="wretched/Character/Skeleton3D/BoneAttachment3D"]
|
||||
transform = Transform3D(0.81687146, 0.42058486, 0.39475226, -0.47940338, 0.8755994, 0.059143633, -0.3207699, -0.2375583, 0.91688204, -0.0065350886, 0.06456717, -0.0151789)
|
||||
collision_layer = 0
|
||||
collision_mask = 10
|
||||
monitorable = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="wretched/Character/Skeleton3D/BoneAttachment3D/Area3D"]
|
||||
transform = Transform3D(1, -5.722046e-06, -4.0163286e-08, 2.3841858e-07, 1.0000094, -2.0547304e-08, 2.438901e-07, 7.899827e-06, 1, -0.29290777, -2.9802322e-07, -2.3841858e-07)
|
||||
shape = SubResource("BoxShape3D_cpfor")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
|
@ -95,17 +44,6 @@ transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, 0, 1
|
|||
unique_name_in_owner = true
|
||||
health = 2
|
||||
|
||||
[node name="Hitbox" type="Hitbox" parent="." node_paths=PackedStringArray("health")]
|
||||
transform = Transform3D(1, 2.1910389e-16, -2.2202524e-16, -2.2202514e-16, 0.9999124, -0.013243958, 2.1910394e-16, 0.01324396, 0.9999123, 6.209e-17, 0.097789526, 0.004007945)
|
||||
collision_layer = 6
|
||||
collision_mask = 0
|
||||
monitoring = false
|
||||
health = NodePath("../HealthStatus")
|
||||
|
||||
[node name="CollisionShape3D2" type="CollisionShape3D" parent="Hitbox"]
|
||||
transform = Transform3D(1, 5.875464e-21, 0, 6.2038546e-25, 1.0000037, 0, 0, 0, 1.0000037, -2.2362435e-16, 0.35283393, -0.013339132)
|
||||
shape = SubResource("BoxShape3D_sivli")
|
||||
|
||||
[connection signal="death" from="HealthStatus" to="." method="_on_health_status_death"]
|
||||
|
||||
[editable path="wretched"]
|
||||
|
|
|
@ -2,11 +2,6 @@
|
|||
|
||||
[ext_resource type="PackedScene" uid="uid://ce40pq785yoyi" path="res://objects/weapons/rifle.tscn" id="1_eqqp1"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_bxedw"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_eqqp1"]
|
||||
radius = 0.3173828
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_eqqp1"]
|
||||
script/source = "extends HealthStatus
|
||||
|
||||
|
@ -14,24 +9,33 @@ func _on_health_changed(remaining: int, delta: int) -> void:
|
|||
print(\"Player Health Changed:\", delta, \"remaining:\", remaining)
|
||||
"
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_bxedw"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_eqqp1"]
|
||||
radius = 0.3173828
|
||||
|
||||
[node name="PlayerBody" type="PlayerBody"]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
shape = SubResource("CapsuleShape3D_bxedw")
|
||||
|
||||
[node name="PlayerInput" type="PlayerInput" parent="."]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="PlayerCamera" type="PlayerCamera" parent="."]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 1.60811, 0)
|
||||
fov = 60.0
|
||||
|
||||
[node name="PlayerInput" type="PlayerInput" parent="."]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="WeaponInventory" type="WeaponInventory" parent="."]
|
||||
unique_name_in_owner = true
|
||||
starting_weapon = ExtResource("1_eqqp1")
|
||||
|
||||
[node name="HealthStatus" type="HealthStatus" parent="."]
|
||||
health = 10
|
||||
script = SubResource("GDScript_eqqp1")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
shape = SubResource("CapsuleShape3D_bxedw")
|
||||
|
||||
[node name="Hitbox" type="Hitbox" parent="." node_paths=PackedStringArray("health")]
|
||||
collision_layer = 8
|
||||
collision_mask = 0
|
||||
|
@ -42,7 +46,4 @@ health = NodePath("../HealthStatus")
|
|||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
shape = SubResource("CapsuleShape3D_eqqp1")
|
||||
|
||||
[node name="HealthStatus" type="HealthStatus" parent="."]
|
||||
script = SubResource("GDScript_eqqp1")
|
||||
|
||||
[connection signal="health_changed" from="HealthStatus" to="HealthStatus" method="_on_health_changed"]
|
||||
|
|
Loading…
Reference in a new issue