feat: start of firing enemies

This commit is contained in:
Sara 2024-12-09 23:55:11 +01:00
parent 7a6aefc44c
commit 2054474c01
12 changed files with 212 additions and 14 deletions

View file

@ -1,18 +1,41 @@
[gd_scene load_steps=4 format=3 uid="uid://c2kiuk2yxdlfr"]
[gd_scene load_steps=6 format=3 uid="uid://c2kiuk2yxdlfr"]
[ext_resource type="PackedScene" uid="uid://1kr3qqan3trk" path="res://objects/player.tscn" id="1_7kr4i"]
[ext_resource type="PackedScene" uid="uid://dm3355tbkvx24" path="res://objects/section_2.tscn" id="2_og5hb"]
[ext_resource type="PackedScene" uid="uid://0fykl1mw3c12" path="res://objects/enemy.tscn" id="3_ppe0x"]
[sub_resource type="GDScript" id="GDScript_peyat"]
script/source = "extends Area3D
func _on_body_entered(body: Node3D) -> void:
if body is Player:
$\"../Enemy2\".notice_player(body as Player)
$\"../Enemy\".notice_player(body as Player)
"
[sub_resource type="BoxShape3D" id="BoxShape3D_ggysn"]
size = Vector3(3.69043, 1, 8.0553)
[node name="Boot" type="Node3D"]
[node name="Environment" parent="." instance=ExtResource("2_og5hb")]
[node name="Enemy" parent="." instance=ExtResource("3_ppe0x")]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 9.02629, 0.21507, -7.46576)
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 9.02629, 0.258895, -7.46576)
[node name="Area3D" type="Area3D" parent="."]
transform = Transform3D(0.734015, 0, -0.679134, 0, 1, 0, 0.679134, 0, 0.734015, 2.09421, 0.536154, -14.1446)
script = SubResource("GDScript_peyat")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
transform = Transform3D(1, 0, -4.91743e-07, 0, 1, 0, 4.91743e-07, 0, 1, 0, 0, 0)
shape = SubResource("BoxShape3D_ggysn")
[node name="Enemy2" parent="." instance=ExtResource("3_ppe0x")]
transform = Transform3D(0.139795, 0, -0.990181, 0, 1, 0, 0.990181, 0, 0.139795, 8.69408, 0.536154, -15.4052)
[node name="Player" parent="." instance=ExtResource("1_7kr4i")]
transform = Transform3D(0.0816776, 0, 0.996659, 0, 1, 0, -0.996659, 0, 0.0816776, -2.58966, 0.891191, -2.77265)
[connection signal="body_entered" from="Area3D" to="Area3D" method="_on_body_entered"]

View file

@ -172,9 +172,9 @@ advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_g0i3x"]
xfade_time = 0.4
priority = 2
advance_mode = 2
advance_expression = "get_is_running()
"
advance_expression = "get_is_running() && is_walking()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ocffv"]
xfade_time = 0.3
@ -185,7 +185,7 @@ advance_expression = "get_is_running()
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_h0my5"]
xfade_time = 0.4
advance_mode = 2
advance_expression = "!get_is_running()"
advance_expression = "!get_is_running() || !is_walking()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_nymcr"]
xfade_time = 0.3
@ -205,6 +205,7 @@ advance_expression = "get_is_running()
"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_4q0ot"]
priority = 2
advance_mode = 2
advance_expression = "get_stab()"
@ -244,7 +245,7 @@ states/Start/position = Vector2(572.26, 14.954)
"states/Walk [turn]/node" = SubResource("AnimationNodeBlendTree_2mbyh")
"states/Walk [turn]/position" = Vector2(572.26, 258.767)
transitions = ["Aim [aim] [turn]", "Aim Down [aim]", SubResource("AnimationNodeStateMachineTransition_4lybd"), "Aim Down [aim]", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_5aafd"), "Aim [aim] [turn]", "Fire [aim]", SubResource("AnimationNodeStateMachineTransition_8f4gl"), "Fire [aim]", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_xnat3"), "Walk [turn]", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_12bos"), "Aim Down [aim]", "Stationary [turn]", SubResource("AnimationNodeStateMachineTransition_n0ndr"), "Walk [turn]", "Stationary [turn]", SubResource("AnimationNodeStateMachineTransition_0wc5e"), "Stationary [turn]", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_4hisb"), "Start", "Stationary [turn]", SubResource("AnimationNodeStateMachineTransition_bmty6"), "Stationary [turn]", "RESET To Aim", SubResource("AnimationNodeStateMachineTransition_kyd6p"), "RESET To Aim", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_w5kob"), "Stationary [turn]", "Run", SubResource("AnimationNodeStateMachineTransition_g0i3x"), "Walk [turn]", "Run", SubResource("AnimationNodeStateMachineTransition_ocffv"), "Run", "Stationary [turn]", SubResource("AnimationNodeStateMachineTransition_h0my5"), "Run", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_nymcr"), "Run", "Stab", SubResource("AnimationNodeStateMachineTransition_g5qf0"), "Stab", "Run", SubResource("AnimationNodeStateMachineTransition_27kmb"), "Stationary [turn]", "Stab", SubResource("AnimationNodeStateMachineTransition_4q0ot"), "Stab", "Stationary [turn]", SubResource("AnimationNodeStateMachineTransition_h6ujc"), "Walk [turn]", "Stab", SubResource("AnimationNodeStateMachineTransition_3bu8l"), "Stab", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_cpibo")]
graph_offset = Vector2(-172.078, -8.655)
graph_offset = Vector2(-87.4971, -116.108)
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_au62i"]
animation = &"Fall_die"

View file

@ -98,4 +98,7 @@ aim_weapon = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.19104, 0)
shape = SubResource("CapsuleShape3D_3tduq")
[node name="NavigationAgent3D" type="NavigationAgent3D" parent="."]
unique_name_in_owner = true
[editable path="CharacterModel"]

View file

@ -11,7 +11,7 @@ radius = 0.1
[node name="Player" type="Player"]
collision_layer = 3
collision_mask = 3
floor_snap_length = 0.2
floor_snap_length = 1.0
[node name="CharacterModel" parent="." instance=ExtResource("1_cwt7u")]
unique_name_in_owner = true

View file

@ -353,7 +353,16 @@ frequency_max = 5.0
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.66028, 2.51555, -0.763191)
[node name="ArtilleryTarget3" parent="." instance=ExtResource("13_rl1f8")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.00799, 2.51555, -22.162)
frequency_max = 8.0
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.977764, 2.51555, -22.0148)
[node name="ArtilleryTarget6" parent="." instance=ExtResource("13_rl1f8")]
frequency_max = 8.0
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.26403, 2.51555, -11.5654)
[node name="ArtilleryTarget7" parent="." instance=ExtResource("13_rl1f8")]
frequency_max = 8.0
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 17.9765, 2.51555, -24.0753)
[node name="ArtilleryTarget4" parent="." instance=ExtResource("13_rl1f8")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18.9532, 2.51555, -6.60339)