Add attacking, enemies, death, and much more
This commit is contained in:
parent
a5dbfe6bbf
commit
1c20cde2ce
@ -42,3 +42,25 @@ move_jump={
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
click={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(130, 14),"global_position":Vector2(139, 62),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
right_click={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(159, 19),"global_position":Vector2(168, 67),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
dash={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[layer_names]
|
||||
|
||||
3d_physics/layer_1="World"
|
||||
3d_physics/layer_2="Interaction"
|
||||
3d_physics/layer_3="Player"
|
||||
3d_physics/layer_4="Enemy"
|
||||
|
||||
11
src/scenes/characters/area_attack.tscn
Normal file
11
src/scenes/characters/area_attack.tscn
Normal file
@ -0,0 +1,11 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bo62qyfwylypa"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://nekr2inm6vnq" path="res://src/scripts/characters/area_attack.gd" id="1_7eso7"]
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_kkooa"]
|
||||
radius = 1.0
|
||||
|
||||
[node name="AreaAttack" type="ShapeCast3D"]
|
||||
shape = SubResource("CylinderShape3D_kkooa")
|
||||
target_position = Vector3(0, 0, 0)
|
||||
script = ExtResource("1_7eso7")
|
||||
11
src/scenes/characters/dash.tscn
Normal file
11
src/scenes/characters/dash.tscn
Normal file
@ -0,0 +1,11 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cwdsfw1g1607y"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ekvwb7r88vda" path="res://src/scripts/characters/dash.gd" id="1_bwbfr"]
|
||||
|
||||
[node name="Dash" type="Node3D"]
|
||||
script = ExtResource("1_bwbfr")
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
|
||||
[node name="GPUParticles3D" type="GPUParticles3D" parent="."]
|
||||
@ -1,94 +1,72 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://ckwydalda0teo"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://cwvrti8hmxj0k"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ckjbqjere1jpf" path="res://src/scripts/player/rig.gd" id="1_1br2m"]
|
||||
[ext_resource type="PackedScene" uid="uid://xivf38sp0l78" path="res://assets/models/character/character_rig.glb" id="1_icnkf"]
|
||||
[ext_resource type="Script" uid="uid://p38hhb8jwgor" path="res://src/scripts/characters/enemy.gd" id="1_jr6vw"]
|
||||
[ext_resource type="PackedScene" uid="uid://ckwydalda0teo" path="res://src/scenes/characters/rig.tscn" id="2_saeby"]
|
||||
[ext_resource type="PackedScene" uid="uid://bo62qyfwylypa" path="res://src/scenes/characters/area_attack.tscn" id="3_ljmr7"]
|
||||
[ext_resource type="PackedScene" uid="uid://dw8f5oy13cdtx" path="res://src/scenes/characters/health_component.tscn" id="3_r8u7w"]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_eek7r"]
|
||||
animation = &"Run"
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_r8u7w"]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_gxy77"]
|
||||
animation = &"Idle"
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ljmr7"]
|
||||
|
||||
[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_djdpq"]
|
||||
blend_point_0/node = SubResource("AnimationNodeAnimation_eek7r")
|
||||
blend_point_0/pos = 1.0
|
||||
blend_point_1/node = SubResource("AnimationNodeAnimation_gxy77")
|
||||
blend_point_1/pos = -1.0
|
||||
[node name="Enemy" type="CharacterBody3D"]
|
||||
collision_layer = 9
|
||||
script = ExtResource("1_jr6vw")
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_1br2m"]
|
||||
animation = &"Slash"
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("CapsuleShape3D_r8u7w")
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_gkl4x"]
|
||||
advance_mode = 2
|
||||
[node name="Rig" parent="." instance=ExtResource("2_saeby")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0)
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_eek7r"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_gxy77"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_mq48a"]
|
||||
states/MoveSpace/node = SubResource("AnimationNodeBlendSpace1D_djdpq")
|
||||
states/MoveSpace/position = Vector2(434, 28)
|
||||
states/Slash/node = SubResource("AnimationNodeAnimation_1br2m")
|
||||
states/Slash/position = Vector2(434, 135)
|
||||
states/Start/position = Vector2(239, 28)
|
||||
transitions = ["Start", "MoveSpace", SubResource("AnimationNodeStateMachineTransition_gkl4x"), "MoveSpace", "Slash", SubResource("AnimationNodeStateMachineTransition_eek7r"), "Slash", "MoveSpace", SubResource("AnimationNodeStateMachineTransition_gxy77")]
|
||||
graph_offset = Vector2(-357, -91)
|
||||
|
||||
[node name="Rig" type="Node3D"]
|
||||
script = ExtResource("1_1br2m")
|
||||
|
||||
[node name="CharacterRig" parent="." instance=ExtResource("1_icnkf")]
|
||||
|
||||
[node name="Skeleton3D" parent="CharacterRig/GameRig" index="0"]
|
||||
bones/0/position = Vector3(3.37508e-15, 0.891988, -0.0481736)
|
||||
[node name="Skeleton3D" parent="Rig/CharacterRig/GameRig" index="0"]
|
||||
bones/0/position = Vector3(2.90402e-15, 0.896258, -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.00441575, -0.000457798, 0.00321564, 0.999985)
|
||||
bones/2/rotation = Quaternion(-0.00237686, -0.000424754, 0.00321495, 0.999992)
|
||||
bones/3/position = Vector3(-2.01263e-09, 0.202058, -2.51457e-08)
|
||||
bones/3/rotation = Quaternion(-0.0994171, -0.000418098, 0.00851803, 0.995009)
|
||||
bones/3/rotation = Quaternion(-0.0969743, -0.000386353, 0.00851974, 0.99525)
|
||||
bones/4/position = Vector3(3.02934e-10, 0.0925562, 3.91155e-08)
|
||||
bones/4/rotation = Quaternion(0.278845, 1.4315e-08, 9.57075e-08, 0.960336)
|
||||
bones/4/rotation = Quaternion(0.277539, 1.51857e-08, 9.21549e-08, 0.960715)
|
||||
bones/5/rotation = Quaternion(-0.0948564, -2.80691e-14, -2.26155e-08, 0.995491)
|
||||
bones/6/rotation = Quaternion(-0.153723, -1.17812e-07, -1.81868e-08, 0.988114)
|
||||
bones/7/position = Vector3(-3.15335e-08, 0.891988, -0.0481735)
|
||||
bones/6/rotation = Quaternion(-0.155564, -1.17871e-07, -1.78202e-08, 0.987826)
|
||||
bones/7/position = Vector3(-2.19489e-08, 0.896258, -0.0481735)
|
||||
bones/7/rotation = Quaternion(-0.0863677, -0.751104, -0.383052, 0.530711)
|
||||
bones/8/position = Vector3(-5.01311e-08, 0.891988, -0.0481735)
|
||||
bones/8/position = Vector3(-3.46394e-08, 0.896258, -0.0481735)
|
||||
bones/8/rotation = Quaternion(-0.0863677, 0.751104, 0.383052, 0.530711)
|
||||
bones/9/position = Vector3(0.131144, 0.958192, -0.0351291)
|
||||
bones/9/rotation = Quaternion(0.992486, 0.0211361, -0.030826, 0.116508)
|
||||
bones/9/position = Vector3(0.131144, 0.962462, -0.0351291)
|
||||
bones/9/rotation = Quaternion(0.9929, 0.0209334, -0.0309203, 0.112942)
|
||||
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.431573, -0.000700556, 0.000335292, 0.902078)
|
||||
bones/11/rotation = Quaternion(0.423309, -0.000700623, 0.000327516, 0.905985)
|
||||
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.756674, 0.0119043, 0.0244321, 0.653227)
|
||||
bones/13/rotation = Quaternion(-0.752924, 0.0118904, 0.0244113, 0.657548)
|
||||
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.958192, -0.0351291)
|
||||
bones/15/rotation = Quaternion(0.972155, -0.00597653, 0.0271868, 0.232681)
|
||||
bones/15/position = Vector3(-0.131144, 0.962462, -0.0351291)
|
||||
bones/15/rotation = Quaternion(0.972885, -0.00584074, 0.0272814, 0.2296)
|
||||
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.454904, 0.00335452, -0.00171366, 0.890532)
|
||||
bones/17/rotation = Quaternion(0.447168, 0.00330884, -0.00165434, 0.894442)
|
||||
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.692097, -0.0282132, -0.000453438, 0.721253)
|
||||
bones/19/rotation = Quaternion(-0.689461, -0.0281994, -0.000643605, 0.723773)
|
||||
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.42323, 0.0409021)
|
||||
bones/21/rotation = Quaternion(-0.50156, -0.254509, -0.394033, 0.726912)
|
||||
bones/22/position = Vector3(0.187432, 1.45872, -0.0285825)
|
||||
bones/22/rotation = Quaternion(0.06045, -0.158053, 0.973842, -0.151647)
|
||||
bones/21/position = Vector3(0.0251286, 1.4265, 0.0421425)
|
||||
bones/21/rotation = Quaternion(-0.49414, -0.257647, -0.39943, 0.727942)
|
||||
bones/22/position = Vector3(0.188376, 1.46325, -0.0244898)
|
||||
bones/22/rotation = Quaternion(0.0511605, -0.159492, 0.974374, -0.150133)
|
||||
bones/23/position = Vector3(-5.41331e-09, 0.143946, -2.98023e-08)
|
||||
bones/23/rotation = Quaternion(7.73339e-08, -0.0080107, -1.99305e-08, 0.999968)
|
||||
bones/23/rotation = Quaternion(5.35386e-08, -0.0148926, 5.04572e-08, 0.999889)
|
||||
bones/24/position = Vector3(-6.33301e-08, 0.143946, 4.3873e-08)
|
||||
bones/24/rotation = Quaternion(0.277839, -0.00675305, -0.016611, 0.96046)
|
||||
bones/24/rotation = Quaternion(0.296573, -0.0148933, -0.0181015, 0.954722)
|
||||
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)
|
||||
@ -113,14 +91,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.42323, 0.0409021)
|
||||
bones/46/rotation = Quaternion(-0.527917, 0.201754, 0.357521, 0.743491)
|
||||
bones/47/position = Vector3(-0.162072, 1.45806, -0.0513614)
|
||||
bones/47/rotation = Quaternion(-0.101804, -0.132181, 0.97079, 0.172428)
|
||||
bones/46/position = Vector3(-0.0113635, 1.4265, 0.0421424)
|
||||
bones/46/rotation = Quaternion(-0.513706, 0.217774, 0.372161, 0.741739)
|
||||
bones/47/position = Vector3(-0.166452, 1.46367, -0.0415526)
|
||||
bones/47/rotation = Quaternion(-0.0791267, -0.136168, 0.972901, 0.169297)
|
||||
bones/48/position = Vector3(1.88476e-07, 0.143946, 1.02445e-08)
|
||||
bones/48/rotation = Quaternion(-3.76897e-08, -0.00451446, -5.02688e-08, 0.99999)
|
||||
bones/48/rotation = Quaternion(-4.99971e-09, 0.0109135, -2.38681e-08, 0.99994)
|
||||
bones/49/position = Vector3(6.5191e-09, 0.143946, -1.95094e-08)
|
||||
bones/49/rotation = Quaternion(0.307483, -0.00462726, 0.0284921, 0.951116)
|
||||
bones/49/rotation = Quaternion(0.329063, 0.0109141, 0.028922, 0.943802)
|
||||
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)
|
||||
@ -146,24 +124,40 @@ 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.34028, -0.0269978)
|
||||
bones/71/rotation = Quaternion(1.89247e-08, 0.618632, 0.785681, -4.66233e-08)
|
||||
bones/72/position = Vector3(-0.113426, 1.34028, -0.0269979)
|
||||
bones/72/rotation = Quaternion(1.89247e-08, 0.618632, 0.785681, -4.66232e-08)
|
||||
bones/71/position = Vector3(0.127191, 1.34482, -0.0264471)
|
||||
bones/71/rotation = Quaternion(1.92656e-08, 0.613671, 0.789562, -4.64417e-08)
|
||||
bones/72/position = Vector3(-0.113426, 1.34482, -0.0264471)
|
||||
bones/72/rotation = Quaternion(1.92657e-08, 0.613671, 0.789562, -4.64417e-08)
|
||||
|
||||
[node name="Knight_01" parent="CharacterRig/GameRig/Skeleton3D" index="0"]
|
||||
[node name="Knight_02" parent="Rig/CharacterRig/GameRig/Skeleton3D" index="1"]
|
||||
visible = false
|
||||
|
||||
[node name="Villager_01" parent="CharacterRig/GameRig/Skeleton3D" index="2"]
|
||||
[node name="Villager_01" parent="Rig/CharacterRig/GameRig/Skeleton3D" index="2"]
|
||||
visible = true
|
||||
|
||||
[node name="RightHandBone" parent="Rig" index="2"]
|
||||
transform = Transform3D(-0.962343, -0.270803, -0.0237135, 0.241713, -0.892346, 0.381174, -0.124384, 0.361088, 0.924199, -0.340269, 0.981412, -0.0317979)
|
||||
|
||||
[node name="LeftHandBone" parent="Rig" index="3"]
|
||||
transform = Transform3D(-0.970513, 0.239108, 0.0305212, -0.22202, -0.936013, 0.273107, 0.0938704, 0.258277, 0.961499, 0.345187, 0.969535, -0.0501543)
|
||||
|
||||
[node name="tall_shield" parent="Rig/LeftHandBone/OffHandSlot" index="0"]
|
||||
visible = false
|
||||
|
||||
[node name="Villager_02" parent="CharacterRig/GameRig/Skeleton3D" index="3"]
|
||||
visible = false
|
||||
[node name="PlayerDetector" type="ShapeCast3D" parent="Rig"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1)
|
||||
shape = SubResource("CapsuleShape3D_ljmr7")
|
||||
target_position = Vector3(0, 0, 0)
|
||||
collision_mask = 4
|
||||
|
||||
[node name="AnimationTree" type="AnimationTree" parent="."]
|
||||
root_node = NodePath("../CharacterRig")
|
||||
tree_root = SubResource("AnimationNodeStateMachine_mq48a")
|
||||
anim_player = NodePath("../CharacterRig/AnimationPlayer")
|
||||
parameters/MoveSpace/blend_position = -5.743
|
||||
[node name="AreaAttack" parent="Rig" instance=ExtResource("3_ljmr7")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1)
|
||||
collision_mask = 4
|
||||
|
||||
[editable path="CharacterRig"]
|
||||
[node name="HealthComponent" parent="." instance=ExtResource("3_r8u7w")]
|
||||
|
||||
[connection signal="heavy_attack" from="Rig" to="." method="_on_rig_heavy_attack"]
|
||||
[connection signal="defeat" from="HealthComponent" to="." method="_on_health_component_defeat"]
|
||||
|
||||
[editable path="Rig"]
|
||||
[editable path="Rig/CharacterRig"]
|
||||
6
src/scenes/characters/health_component.tscn
Normal file
6
src/scenes/characters/health_component.tscn
Normal file
@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://dw8f5oy13cdtx"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b80knj2xg2m76" path="res://src/scripts/characters/health_component.gd" id="1_kfys7"]
|
||||
|
||||
[node name="HealthComponent" type="Node"]
|
||||
script = ExtResource("1_kfys7")
|
||||
183
src/scenes/characters/player.tscn
Normal file
183
src/scenes/characters/player.tscn
Normal file
@ -0,0 +1,183 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://nsv4lbw7j8mi"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://csgybabwb8cbg" path="res://src/scripts/characters/player.gd" id="1_swhsd"]
|
||||
[ext_resource type="PackedScene" uid="uid://dw8f5oy13cdtx" path="res://src/scenes/characters/health_component.tscn" id="2_0xash"]
|
||||
[ext_resource type="Script" uid="uid://cxnvqh8ijf0ox" path="res://src/scripts/characters/boom.gd" id="2_qopur"]
|
||||
[ext_resource type="PackedScene" uid="uid://ckwydalda0teo" path="res://src/scenes/characters/rig.tscn" id="3_n52bt"]
|
||||
[ext_resource type="Script" uid="uid://blbnvx6pe37mc" path="res://src/scripts/characters/attack_cast.gd" id="4_cx3ie"]
|
||||
[ext_resource type="PackedScene" uid="uid://bo62qyfwylypa" path="res://src/scenes/characters/area_attack.tscn" id="6_wmokw"]
|
||||
[ext_resource type="PackedScene" uid="uid://cwdsfw1g1607y" path="res://src/scenes/characters/dash.tscn" id="7_yvk1n"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_yx56f"]
|
||||
|
||||
[sub_resource type="SeparationRayShape3D" id="SeparationRayShape3D_swhsd"]
|
||||
|
||||
[node name="Player" type="CharacterBody3D"]
|
||||
collision_layer = 5
|
||||
script = ExtResource("1_swhsd")
|
||||
|
||||
[node name="HealthComponent" parent="." instance=ExtResource("2_0xash")]
|
||||
|
||||
[node name="Dash" parent="." node_paths=PackedStringArray("player") instance=ExtResource("7_yvk1n")]
|
||||
player = NodePath("..")
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("CapsuleShape3D_yx56f")
|
||||
|
||||
[node name="Boom" type="SpringArm3D" parent="." node_paths=PackedStringArray("target")]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.866025, 0.5, 0, -0.5, 0.866025, 0, 1, 0)
|
||||
shape = SubResource("SeparationRayShape3D_swhsd")
|
||||
spring_length = 4.0
|
||||
script = ExtResource("2_qopur")
|
||||
target = NodePath("../HorizontalPivot/VerticalPivot")
|
||||
|
||||
[node name="Camera" type="Camera3D" parent="Boom"]
|
||||
|
||||
[node name="HorizontalPivot" type="Node3D" parent="."]
|
||||
|
||||
[node name="VerticalPivot" type="Node3D" parent="HorizontalPivot"]
|
||||
|
||||
[node name="RigPivot" type="Node3D" parent="."]
|
||||
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(3.37508e-15, 0.892598, -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.00474949, -0.000463206, 0.00321576, 0.999983)
|
||||
bones/3/position = Vector3(-2.01263e-09, 0.202058, -2.51457e-08)
|
||||
bones/3/rotation = Quaternion(-0.0990345, -0.000413126, 0.00851833, 0.995047)
|
||||
bones/4/position = Vector3(3.02934e-10, 0.0925562, 3.91155e-08)
|
||||
bones/4/rotation = Quaternion(0.279353, 1.411e-08, 9.66205e-08, 0.960189)
|
||||
bones/5/rotation = Quaternion(-0.0948564, -2.80691e-14, -2.26155e-08, 0.995491)
|
||||
bones/6/rotation = Quaternion(-0.153287, -1.18211e-07, -1.56253e-08, 0.988182)
|
||||
bones/7/position = Vector3(-4.01473e-08, 0.892598, -0.0481735)
|
||||
bones/7/rotation = Quaternion(-0.0863677, -0.751104, -0.383052, 0.530711)
|
||||
bones/8/position = Vector3(-6.21924e-08, 0.892598, -0.0481735)
|
||||
bones/8/rotation = Quaternion(-0.0863677, 0.751104, 0.383052, 0.530711)
|
||||
bones/9/position = Vector3(0.131144, 0.958802, -0.0351291)
|
||||
bones/9/rotation = Quaternion(0.992545, 0.0211075, -0.0308392, 0.116007)
|
||||
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.430313, -0.00070061, 0.000334144, 0.902679)
|
||||
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.755929, 0.0119014, 0.0244278, 0.65409)
|
||||
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.958802, -0.0351291)
|
||||
bones/15/rotation = Quaternion(0.972099, -0.00598688, 0.0271796, 0.232916)
|
||||
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.453725, 0.00334755, -0.00170452, 0.891134)
|
||||
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.692303, -0.0282143, -0.000438585, 0.721055)
|
||||
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.42297, 0.0408048)
|
||||
bones/21/rotation = Quaternion(-0.50042, -0.254995, -0.394861, 0.727078)
|
||||
bones/22/position = Vector3(0.187502, 1.45905, -0.0282855)
|
||||
bones/22/rotation = Quaternion(0.059026, -0.158275, 0.973929, -0.151416)
|
||||
bones/23/position = Vector3(-5.41331e-09, 0.143946, -2.98023e-08)
|
||||
bones/23/rotation = Quaternion(4.21752e-08, -0.00851079, -1.92762e-08, 0.999964)
|
||||
bones/24/position = Vector3(-6.33301e-08, 0.143946, 4.3873e-08)
|
||||
bones/24/rotation = Quaternion(0.281763, -0.00845362, -0.01693, 0.959297)
|
||||
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)
|
||||
bones/26/rotation = Quaternion(-0.00824883, -0.00027077, -0.0328667, 0.999426)
|
||||
bones/28/rotation = Quaternion(0.702583, -0.000939743, -0.00133552, 0.7116)
|
||||
bones/29/rotation = Quaternion(0.741121, 0.00218291, 0.00265381, 0.671363)
|
||||
bones/30/rotation = Quaternion(0.32527, 0.890055, 0.295977, -0.119997)
|
||||
bones/31/rotation = Quaternion(0.514882, -0.114149, 0.114482, 0.841879)
|
||||
bones/32/rotation = Quaternion(0.592003, -0.0381348, -0.090699, 0.799907)
|
||||
bones/34/position = Vector3(-0.00316938, 0.0987206, 0.0147918)
|
||||
bones/34/rotation = Quaternion(-0.0674699, 0.718446, 0.0663966, 0.689112)
|
||||
bones/35/rotation = Quaternion(0.580803, -0.000892135, -0.0014975, 0.814042)
|
||||
bones/36/rotation = Quaternion(0.682777, 0.00174509, 0.00256596, 0.73062)
|
||||
bones/37/rotation = Quaternion(-0.00426514, 0.736714, 0.0394785, 0.675038)
|
||||
bones/38/position = Vector3(-0.00622951, 0.0926415, -0.0236344)
|
||||
bones/38/rotation = Quaternion(-0.109873, 0.743351, 0.0333507, 0.658973)
|
||||
bones/39/rotation = Quaternion(0.630039, 0.00151959, 0.00237944, 0.776559)
|
||||
bones/40/rotation = Quaternion(0.652643, -0.00308142, -0.00421108, 0.757648)
|
||||
bones/41/rotation = Quaternion(-0.0684174, 0.72411, 0.0332337, 0.685478)
|
||||
bones/42/position = Vector3(-0.00715362, 0.0679857, -0.0481983)
|
||||
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.42297, 0.0408048)
|
||||
bones/46/rotation = Quaternion(-0.524954, 0.205117, 0.360587, 0.743187)
|
||||
bones/47/position = Vector3(-0.162992, 1.45922, -0.0493854)
|
||||
bones/47/rotation = Quaternion(-0.0970743, -0.133019, 0.971274, 0.171782)
|
||||
bones/48/position = Vector3(1.88476e-07, 0.143946, 1.02445e-08)
|
||||
bones/48/rotation = Quaternion(8.70013e-08, -0.00137778, 7.62615e-08, 0.999999)
|
||||
bones/49/position = Vector3(6.5191e-09, 0.143946, -1.95094e-08)
|
||||
bones/49/rotation = Quaternion(0.312005, -0.00137739, 0.0286124, 0.949649)
|
||||
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)
|
||||
bones/51/rotation = Quaternion(-0.00824876, 0.000270832, 0.032867, 0.999426)
|
||||
bones/52/rotation = Quaternion(-0.2563, 0.855859, 0.0299184, -0.448241)
|
||||
bones/53/rotation = Quaternion(0.694912, 0.107145, -0.103549, 0.703488)
|
||||
bones/54/rotation = Quaternion(0.74112, -0.00218237, -0.00265409, 0.671363)
|
||||
bones/55/rotation = Quaternion(-0.325269, 0.890055, 0.295977, 0.119998)
|
||||
bones/56/rotation = Quaternion(0.514882, 0.11415, -0.114483, 0.841879)
|
||||
bones/57/rotation = Quaternion(0.592004, 0.0381346, 0.0906992, 0.799907)
|
||||
bones/59/position = Vector3(0.00316943, 0.0987207, 0.0147917)
|
||||
bones/59/rotation = Quaternion(0.138771, -0.704916, 0.15571, 0.677932)
|
||||
bones/60/rotation = Quaternion(0.579984, 0.0462615, -0.0308755, 0.812727)
|
||||
bones/61/rotation = Quaternion(0.682777, -0.00174718, -0.00256448, 0.73062)
|
||||
bones/62/rotation = Quaternion(-0.00426532, -0.736714, -0.0394788, 0.675038)
|
||||
bones/63/position = Vector3(0.00622955, 0.0926417, -0.0236344)
|
||||
bones/63/rotation = Quaternion(0.104095, -0.719607, 0.186262, 0.660784)
|
||||
bones/64/rotation = Quaternion(0.670693, 0.0163391, -0.0185663, 0.741323)
|
||||
bones/65/rotation = Quaternion(0.692499, 0.00330364, 0.00403917, 0.7214)
|
||||
bones/66/rotation = Quaternion(-0.0684178, -0.72411, -0.0332339, 0.685477)
|
||||
bones/67/position = Vector3(0.00715371, 0.0679859, -0.0481984)
|
||||
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.34061, -0.026958)
|
||||
bones/71/rotation = Quaternion(1.89928e-08, 0.617641, 0.78646, -4.65874e-08)
|
||||
bones/72/position = Vector3(-0.113426, 1.34061, -0.0269581)
|
||||
bones/72/rotation = Quaternion(1.89929e-08, 0.617641, 0.78646, -4.65873e-08)
|
||||
|
||||
[node name="RightHandBone" parent="RigPivot/Rig" index="2"]
|
||||
transform = Transform3D(-0.962343, -0.2708, -0.0237162, 0.246289, -0.9055, 0.34556, -0.115053, 0.326706, 0.938097, -0.336809, 0.973542, -0.0481699)
|
||||
|
||||
[node name="LeftHandBone" parent="RigPivot/Rig" index="3"]
|
||||
transform = Transform3D(-0.970496, 0.239167, 0.0306141, -0.224995, -0.943919, 0.241652, 0.0866923, 0.227634, 0.96988, 0.344327, 0.96324, -0.0615967)
|
||||
|
||||
[node name="RayAttachment" type="BoneAttachment3D" parent="RigPivot/Rig"]
|
||||
transform = Transform3D(-0.962343, -0.2708, -0.0237162, 0.246289, -0.9055, 0.34556, -0.115053, 0.326706, 0.938097, -0.336809, 0.973542, -0.0481699)
|
||||
bone_name = "DEF-hand.R"
|
||||
bone_idx = 51
|
||||
use_external_skeleton = true
|
||||
external_skeleton = NodePath("../CharacterRig/GameRig/Skeleton3D")
|
||||
|
||||
[node name="AttackCast" type="RayCast3D" parent="RigPivot/Rig/RayAttachment"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(0.16656, 0.0770401, -0.983017, -0.982939, 0.0918653, -0.159347, 0.078029, 0.992787, 0.0910268, -0.0211409, 0.0798348, 0.00721136)
|
||||
target_position = Vector3(0, 1, 0)
|
||||
collision_mask = 8
|
||||
script = ExtResource("4_cx3ie")
|
||||
|
||||
[node name="AreaAttack" parent="RigPivot" instance=ExtResource("6_wmokw")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1)
|
||||
collision_mask = 8
|
||||
|
||||
[connection signal="defeat" from="HealthComponent" to="." method="_on_health_component_defeat"]
|
||||
[connection signal="heavy_attack" from="RigPivot/Rig" to="." method="_on_rig_heavy_attack"]
|
||||
|
||||
[editable path="RigPivot/Rig"]
|
||||
[editable path="RigPivot/Rig/CharacterRig"]
|
||||
224
src/scenes/characters/rig.tscn
Normal file
224
src/scenes/characters/rig.tscn
Normal file
@ -0,0 +1,224 @@
|
||||
[gd_scene load_steps=19 format=3 uid="uid://ckwydalda0teo"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ckjbqjere1jpf" path="res://src/scripts/characters/rig.gd" id="1_n80wy"]
|
||||
[ext_resource type="PackedScene" uid="uid://xivf38sp0l78" path="res://assets/models/character/character_rig.glb" id="2_ow4sk"]
|
||||
[ext_resource type="PackedScene" uid="uid://bnkhiay2id2kl" path="res://assets/models/character/gear/longsword.glb" id="3_dka8l"]
|
||||
[ext_resource type="PackedScene" uid="uid://c7ahf78h5s3kx" path="res://assets/models/character/gear/tall_shield.glb" id="4_i4vhj"]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_6b80y"]
|
||||
animation = &"Defeat"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_eek7r"]
|
||||
animation = &"Run"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_gxy77"]
|
||||
animation = &"Idle"
|
||||
|
||||
[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_djdpq"]
|
||||
blend_point_0/node = SubResource("AnimationNodeAnimation_eek7r")
|
||||
blend_point_0/pos = 1.0
|
||||
blend_point_1/node = SubResource("AnimationNodeAnimation_gxy77")
|
||||
blend_point_1/pos = -1.0
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_q073i"]
|
||||
animation = &"Overhead"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_bd73k"]
|
||||
animation = &"OverheadRecover"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_1br2m"]
|
||||
animation = &"Slash"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_gkl4x"]
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_eek7r"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_gxy77"]
|
||||
xfade_time = 0.1
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_isuva"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_8x2vi"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_eqygr"]
|
||||
xfade_time = 0.1
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_mq48a"]
|
||||
states/Defeat/node = SubResource("AnimationNodeAnimation_6b80y")
|
||||
states/Defeat/position = Vector2(584, -69)
|
||||
states/MoveSpace/node = SubResource("AnimationNodeBlendSpace1D_djdpq")
|
||||
states/MoveSpace/position = Vector2(434, 28)
|
||||
states/Overhead/node = SubResource("AnimationNodeAnimation_q073i")
|
||||
states/Overhead/position = Vector2(652, 28)
|
||||
states/OverheadRecover/node = SubResource("AnimationNodeAnimation_bd73k")
|
||||
states/OverheadRecover/position = Vector2(652, 123)
|
||||
states/Slash/node = SubResource("AnimationNodeAnimation_1br2m")
|
||||
states/Slash/position = Vector2(434, 243)
|
||||
states/Start/position = Vector2(239, 28)
|
||||
transitions = ["Start", "MoveSpace", SubResource("AnimationNodeStateMachineTransition_gkl4x"), "MoveSpace", "Slash", SubResource("AnimationNodeStateMachineTransition_eek7r"), "Slash", "MoveSpace", SubResource("AnimationNodeStateMachineTransition_gxy77"), "MoveSpace", "Overhead", SubResource("AnimationNodeStateMachineTransition_isuva"), "Overhead", "OverheadRecover", SubResource("AnimationNodeStateMachineTransition_8x2vi"), "OverheadRecover", "MoveSpace", SubResource("AnimationNodeStateMachineTransition_eqygr")]
|
||||
graph_offset = Vector2(-50, -104)
|
||||
|
||||
[node name="Rig" type="Node3D"]
|
||||
script = ExtResource("1_n80wy")
|
||||
|
||||
[node name="CharacterRig" parent="." instance=ExtResource("2_ow4sk")]
|
||||
|
||||
[node name="Skeleton3D" parent="CharacterRig/GameRig" index="0"]
|
||||
bones/0/position = Vector3(0.0276682, 0.903179, 0.0086448)
|
||||
bones/0/rotation = Quaternion(0.155586, 1.17758e-07, 1.85474e-08, 0.987822)
|
||||
bones/1/rotation = Quaternion(-0.0497934, 0.00362305, 0.058142, 0.997059)
|
||||
bones/2/position = Vector3(6.23959e-10, 0.140892, 3.06754e-08)
|
||||
bones/2/rotation = Quaternion(0.00933042, 0.000201999, -0.0491224, 0.998749)
|
||||
bones/3/position = Vector3(2.32707e-09, 0.175705, -2.21538e-07)
|
||||
bones/3/rotation = Quaternion(-0.265407, 0.0310372, -0.0790426, 0.96039)
|
||||
bones/4/position = Vector3(-7.45063e-09, 0.0827501, -4.22106e-08)
|
||||
bones/4/rotation = Quaternion(0.430518, 0.0184732, 0.225987, 0.873638)
|
||||
bones/5/rotation = Quaternion(-0.0948568, -5.65495e-09, -1.01598e-07, 0.995491)
|
||||
bones/6/rotation = Quaternion(-0.180423, -0.04801, -0.149312, 0.971004)
|
||||
bones/7/position = Vector3(0.0276682, 0.903179, 0.00864496)
|
||||
bones/7/rotation = Quaternion(-0.0703741, -0.739249, -0.405459, 0.533068)
|
||||
bones/8/position = Vector3(0.0276682, 0.903179, 0.00864482)
|
||||
bones/8/rotation = Quaternion(-0.070374, 0.739249, 0.405459, 0.533068)
|
||||
bones/9/position = Vector3(0.158812, 0.968479, 0.0256444)
|
||||
bones/9/rotation = Quaternion(0.986866, -0.0347172, -0.036593, -0.153461)
|
||||
bones/10/position = Vector3(-1.28047e-08, 0.263565, 5.48525e-08)
|
||||
bones/10/rotation = Quaternion(-4.57173e-08, -0.0075665, 2.94687e-08, 0.999971)
|
||||
bones/11/position = Vector3(-7.19732e-09, 0.263565, -7.01984e-08)
|
||||
bones/11/rotation = Quaternion(0.533853, -0.00756582, 0.00477709, 0.84553)
|
||||
bones/12/position = Vector3(-6.11355e-09, 0.223526, 5.72814e-09)
|
||||
bones/12/rotation = Quaternion(2.18907e-08, -0.00327906, 7.14397e-08, 0.999995)
|
||||
bones/13/position = Vector3(-1.06738e-08, 0.223526, 1.43191e-08)
|
||||
bones/13/rotation = Quaternion(-0.486355, 0.0179254, -0.0581729, 0.871638)
|
||||
bones/14/position = Vector3(2.45242e-09, 0.139878, -1.43056e-08)
|
||||
bones/14/rotation = Quaternion(-0.000103867, 0.96745, -0.253064, -0.000381529)
|
||||
bones/15/position = Vector3(-0.103475, 0.968479, 0.0256444)
|
||||
bones/15/rotation = Quaternion(0.925588, 1.73114e-05, 0.0210855, 0.377945)
|
||||
bones/16/position = Vector3(-1.98544e-08, 0.26553, -1.10504e-07)
|
||||
bones/16/rotation = Quaternion(1.83106e-08, 0.00524275, -7.19832e-08, 0.999986)
|
||||
bones/17/position = Vector3(1.9963e-08, 0.26553, 2.04309e-08)
|
||||
bones/17/rotation = Quaternion(0.428998, 0.00524208, -0.00248965, 0.903287)
|
||||
bones/18/position = Vector3(2.07135e-08, 0.225541, 2.05872e-08)
|
||||
bones/18/rotation = Quaternion(6.82911e-08, -0.00656821, 1.66762e-09, 0.999978)
|
||||
bones/19/position = Vector3(6.57201e-09, 0.225541, -9.83437e-09)
|
||||
bones/19/rotation = Quaternion(-0.676712, -0.0268497, 0.00119576, 0.735757)
|
||||
bones/20/position = Vector3(1.26393e-08, 0.139878, -1.33116e-08)
|
||||
bones/20/rotation = Quaternion(-9.94648e-05, 0.967459, -0.253029, -0.00038312)
|
||||
bones/21/position = Vector3(0.0318322, 1.38876, 0.13565)
|
||||
bones/21/rotation = Quaternion(-0.498675, -0.214179, -0.455467, 0.705692)
|
||||
bones/22/position = Vector3(0.198838, 1.40388, 0.0699175)
|
||||
bones/22/rotation = Quaternion(-0.208708, 0.364962, 0.899386, -0.119786)
|
||||
bones/23/position = Vector3(-9.60146e-08, 0.140731, 1.69161e-07)
|
||||
bones/23/rotation = Quaternion(-1.48099e-08, -0.153514, -5.42637e-08, 0.988147)
|
||||
bones/24/position = Vector3(-5.41769e-08, 0.140731, 9.8138e-08)
|
||||
bones/24/rotation = Quaternion(0.52553, -0.153514, -0.276021, 0.789977)
|
||||
bones/25/position = Vector3(1.8073e-08, 0.124275, 4.49017e-08)
|
||||
bones/25/rotation = Quaternion(-4.36853e-07, 0.0212255, 1.16255e-07, 0.999775)
|
||||
bones/26/position = Vector3(1.16654e-07, 0.124275, 2.52368e-07)
|
||||
bones/26/rotation = Quaternion(-0.139349, 0.0209606, -0.253272, 0.957077)
|
||||
bones/28/rotation = Quaternion(0.702583, -0.000939986, -0.00133528, 0.7116)
|
||||
bones/29/rotation = Quaternion(0.74112, 0.00218249, 0.00265346, 0.671364)
|
||||
bones/30/rotation = Quaternion(0.32527, 0.890055, 0.295977, -0.119997)
|
||||
bones/31/rotation = Quaternion(0.514882, -0.114149, 0.114483, 0.841879)
|
||||
bones/32/rotation = Quaternion(0.592003, -0.038135, -0.0906995, 0.799907)
|
||||
bones/34/position = Vector3(-0.00316934, 0.0987206, 0.0147916)
|
||||
bones/34/rotation = Quaternion(-0.0674701, 0.718446, 0.0663974, 0.689112)
|
||||
bones/35/rotation = Quaternion(0.580804, -0.000892605, -0.0014976, 0.814042)
|
||||
bones/36/rotation = Quaternion(0.682777, 0.00174459, 0.00256601, 0.730621)
|
||||
bones/37/rotation = Quaternion(-0.00426538, 0.736714, 0.0394789, 0.675038)
|
||||
bones/38/position = Vector3(-0.00622947, 0.0926414, -0.0236346)
|
||||
bones/38/rotation = Quaternion(-0.109874, 0.743351, 0.0333518, 0.658973)
|
||||
bones/39/rotation = Quaternion(0.63004, 0.00151927, 0.00238002, 0.776557)
|
||||
bones/40/rotation = Quaternion(0.652642, -0.00308157, -0.0042118, 0.757649)
|
||||
bones/41/rotation = Quaternion(-0.0684189, 0.72411, 0.0332352, 0.685477)
|
||||
bones/42/position = Vector3(-0.00715369, 0.0679858, -0.0481985)
|
||||
bones/42/rotation = Quaternion(-0.120913, 0.799109, 0.0358923, 0.587807)
|
||||
bones/43/rotation = Quaternion(0.498693, -0.020271, -0.0256949, 0.866161)
|
||||
bones/44/rotation = Quaternion(0.715384, 0.0353053, 0.0573144, 0.695481)
|
||||
bones/45/rotation = Quaternion(-0.129059, 0.728936, -0.0250262, 0.67184)
|
||||
bones/46/position = Vector3(-0.00423753, 1.39393, 0.137642)
|
||||
bones/46/rotation = Quaternion(-0.437715, 0.32082, 0.377528, 0.750302)
|
||||
bones/47/position = Vector3(-0.166419, 1.45619, 0.090094)
|
||||
bones/47/rotation = Quaternion(-0.165904, -0.456877, 0.803189, 0.344421)
|
||||
bones/48/position = Vector3(-1.79147e-07, 0.142917, 7.63032e-08)
|
||||
bones/48/rotation = Quaternion(-2.96833e-08, -0.0422389, 4.1837e-08, 0.999108)
|
||||
bones/49/position = Vector3(1.0754e-07, 0.142917, 2.90456e-08)
|
||||
bones/49/rotation = Quaternion(0.316857, -0.0422384, 0.415565, 0.851542)
|
||||
bones/50/position = Vector3(5.42904e-08, 0.126555, 7.38829e-09)
|
||||
bones/50/rotation = Quaternion(-1.10793e-07, 0.0256502, 2.23855e-08, 0.999671)
|
||||
bones/51/position = Vector3(-9.53121e-09, 0.126556, 5.9332e-09)
|
||||
bones/51/rotation = Quaternion(-0.0783404, 0.0259177, 0.201201, 0.976068)
|
||||
bones/52/rotation = Quaternion(-0.2563, 0.855859, 0.0299184, -0.448241)
|
||||
bones/53/rotation = Quaternion(0.694912, 0.107144, -0.103548, 0.703488)
|
||||
bones/54/rotation = Quaternion(0.741121, -0.00218248, -0.00265434, 0.671363)
|
||||
bones/55/rotation = Quaternion(-0.32527, 0.890055, 0.295976, 0.119998)
|
||||
bones/56/rotation = Quaternion(0.514882, 0.11415, -0.114482, 0.841879)
|
||||
bones/57/rotation = Quaternion(0.592004, 0.038134, 0.0906991, 0.799907)
|
||||
bones/59/position = Vector3(0.00316948, 0.0987208, 0.0147918)
|
||||
bones/59/rotation = Quaternion(0.138771, -0.704916, 0.15571, 0.677932)
|
||||
bones/60/rotation = Quaternion(0.579985, 0.0462612, -0.0308753, 0.812727)
|
||||
bones/61/rotation = Quaternion(0.682777, -0.00174739, -0.00256467, 0.730621)
|
||||
bones/62/rotation = Quaternion(-0.0042654, -0.736714, -0.0394787, 0.675038)
|
||||
bones/63/position = Vector3(0.00622964, 0.0926415, -0.0236343)
|
||||
bones/63/rotation = Quaternion(0.104096, -0.719607, 0.186262, 0.660785)
|
||||
bones/64/rotation = Quaternion(0.670693, 0.0163393, -0.0185665, 0.741323)
|
||||
bones/65/rotation = Quaternion(0.692499, 0.00330374, 0.0040394, 0.7214)
|
||||
bones/66/rotation = Quaternion(-0.0684177, -0.72411, -0.033234, 0.685477)
|
||||
bones/67/position = Vector3(0.00715371, 0.0679857, -0.0481984)
|
||||
bones/67/rotation = Quaternion(0.108364, -0.768224, 0.166291, 0.608635)
|
||||
bones/68/rotation = Quaternion(0.629954, 0.0295146, 0.0177509, 0.775868)
|
||||
bones/69/rotation = Quaternion(0.816677, -0.0439534, -0.0509862, 0.573155)
|
||||
bones/70/rotation = Quaternion(-0.12906, -0.728936, 0.0250259, 0.67184)
|
||||
bones/71/position = Vector3(0.118584, 1.30715, 0.0484368)
|
||||
bones/71/rotation = Quaternion(0.0614123, 0.53913, 0.83878, 0.0449082)
|
||||
bones/72/position = Vector3(-0.119248, 1.34121, 0.0615744)
|
||||
bones/72/rotation = Quaternion(0.0614123, 0.53913, 0.83878, 0.0449082)
|
||||
|
||||
[node name="Knight_01" parent="CharacterRig/GameRig/Skeleton3D" index="0"]
|
||||
visible = false
|
||||
|
||||
[node name="Villager_01" parent="CharacterRig/GameRig/Skeleton3D" index="2"]
|
||||
visible = false
|
||||
|
||||
[node name="Villager_02" parent="CharacterRig/GameRig/Skeleton3D" index="3"]
|
||||
visible = false
|
||||
|
||||
[node name="AnimationTree" type="AnimationTree" parent="."]
|
||||
root_node = NodePath("../CharacterRig")
|
||||
tree_root = SubResource("AnimationNodeStateMachine_mq48a")
|
||||
anim_player = NodePath("../CharacterRig/AnimationPlayer")
|
||||
parameters/MoveSpace/blend_position = -5.743
|
||||
|
||||
[node name="RightHandBone" type="BoneAttachment3D" parent="."]
|
||||
transform = Transform3D(-0.771571, 0.518161, -0.369035, -0.386879, -0.842715, -0.374375, -0.504978, -0.146085, 0.85068, -0.253479, 1.11055, -0.200387)
|
||||
bone_name = "DEF-hand.R"
|
||||
bone_idx = 51
|
||||
use_external_skeleton = true
|
||||
external_skeleton = NodePath("../CharacterRig/GameRig/Skeleton3D")
|
||||
|
||||
[node name="WeaponSlot" type="Node3D" parent="RightHandBone"]
|
||||
transform = Transform3D(0.16656, 0.0770401, -0.983017, -0.982939, 0.0918653, -0.159347, 0.078029, 0.992787, 0.0910268, -0.0211409, 0.0798348, 0.00721136)
|
||||
|
||||
[node name="longsword" parent="RightHandBone/WeaponSlot" instance=ExtResource("3_dka8l")]
|
||||
|
||||
[node name="LeftHandBone" type="BoneAttachment3D" parent="."]
|
||||
transform = Transform3D(-0.513018, -0.843256, 0.16041, 0.0314673, 0.168275, 0.985238, -0.857801, 0.510492, -0.0597935, 0.114817, 1.2992, 0.475246)
|
||||
bone_name = "DEF-hand.L"
|
||||
bone_idx = 26
|
||||
use_external_skeleton = true
|
||||
external_skeleton = NodePath("../CharacterRig/GameRig/Skeleton3D")
|
||||
|
||||
[node name="OffHandSlot" type="Node3D" parent="LeftHandBone"]
|
||||
transform = Transform3D(0.10564, 0.417333, -0.902592, -0.99124, 0.116542, -0.0621291, 0.0792616, 0.90125, 0.425989, -0.084208, -0.04557, -0.025934)
|
||||
|
||||
[node name="tall_shield" parent="LeftHandBone/OffHandSlot" instance=ExtResource("4_i4vhj")]
|
||||
|
||||
[connection signal="animation_finished" from="AnimationTree" to="." method="_on_animation_tree_animation_finished"]
|
||||
|
||||
[editable path="CharacterRig"]
|
||||
@ -1,10 +1,11 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://dw0lbkh31rofd"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://dw0lbkh31rofd"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://nsv4lbw7j8mi" path="res://src/scenes/player/player.tscn" id="1_crbv0"]
|
||||
[ext_resource type="PackedScene" uid="uid://nsv4lbw7j8mi" path="res://src/scenes/characters/player.tscn" id="1_crbv0"]
|
||||
[ext_resource type="PackedScene" uid="uid://b1fe4n68iivfm" path="res://assets/models/environment/rock_cliff_env_03.glb" id="2_d2tjv"]
|
||||
[ext_resource type="PackedScene" uid="uid://duotcsmd2fwkk" path="res://assets/models/environment/bush_vege_2.glb" id="3_fqsoq"]
|
||||
[ext_resource type="PackedScene" uid="uid://bdg8366pt8iu7" path="res://assets/models/environment/topiary_tree_vege_01.glb" id="4_uvsco"]
|
||||
[ext_resource type="PackedScene" uid="uid://ddh3p0sg6i080" path="res://assets/models/environment/tree_group_vege.glb" id="5_eyekk"]
|
||||
[ext_resource type="PackedScene" uid="uid://cwvrti8hmxj0k" path="res://src/scenes/characters/enemy.tscn" id="6_uvsco"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_amufq"]
|
||||
sky_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
|
||||
@ -94,3 +95,17 @@ transform = Transform3D(0.910214, 0, 0.414137, 0, 1, 0, -0.414137, 0, 0.910214,
|
||||
|
||||
[node name="tree_group_vege" parent="Vegetation" instance=ExtResource("5_eyekk")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.01405, 3.8147e-06, 6.12766)
|
||||
|
||||
[node name="Enemies" type="Node3D" parent="."]
|
||||
|
||||
[node name="Enemy1" parent="Enemies" instance=ExtResource("6_uvsco")]
|
||||
transform = Transform3D(0.748366, 0, -0.663286, 0, 1, 0, 0.663286, 0, 0.748366, 5.25312, 1, -7.01228)
|
||||
|
||||
[node name="Enemy2" parent="Enemies" instance=ExtResource("6_uvsco")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.44962, 1, -7.01217)
|
||||
|
||||
[node name="Enemy3" parent="Enemies" instance=ExtResource("6_uvsco")]
|
||||
transform = Transform3D(0.910684, 0, 0.413104, 0, 1, 0, -0.413104, 0, 0.910684, -11.1807, 1, -13.9047)
|
||||
|
||||
[node name="Enemy4" parent="Enemies" instance=ExtResource("6_uvsco")]
|
||||
transform = Transform3D(-0.503623, 0, 0.863923, 0, 1, 0, -0.863923, 0, -0.503623, -5.81376, 1, 15.3224)
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://nsv4lbw7j8mi"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://csgybabwb8cbg" path="res://src/scripts/player/player.gd" id="1_swhsd"]
|
||||
[ext_resource type="Script" uid="uid://cxnvqh8ijf0ox" path="res://src/scripts/player/boom.gd" id="2_qopur"]
|
||||
[ext_resource type="PackedScene" uid="uid://ckwydalda0teo" path="res://src/scenes/player/rig.tscn" id="3_n52bt"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_yx56f"]
|
||||
|
||||
[sub_resource type="SeparationRayShape3D" id="SeparationRayShape3D_swhsd"]
|
||||
|
||||
[node name="Player" type="CharacterBody3D"]
|
||||
script = ExtResource("1_swhsd")
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("CapsuleShape3D_yx56f")
|
||||
|
||||
[node name="Boom" type="SpringArm3D" parent="." node_paths=PackedStringArray("target")]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.866025, 0.5, 0, -0.5, 0.866025, 0, 1, 0)
|
||||
shape = SubResource("SeparationRayShape3D_swhsd")
|
||||
spring_length = 4.0
|
||||
script = ExtResource("2_qopur")
|
||||
target = NodePath("../HorizontalPivot/VerticalPivot")
|
||||
|
||||
[node name="Camera" type="Camera3D" parent="Boom"]
|
||||
|
||||
[node name="HorizontalPivot" type="Node3D" parent="."]
|
||||
|
||||
[node name="VerticalPivot" type="Node3D" parent="HorizontalPivot"]
|
||||
|
||||
[node name="RigPivot" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0)
|
||||
|
||||
[node name="Rig" parent="RigPivot" instance=ExtResource("3_n52bt")]
|
||||
@ -1,32 +0,0 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://nsv4lbw7j8mi"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://csgybabwb8cbg" path="res://src/scripts/player/player.gd" id="1_swhsd"]
|
||||
[ext_resource type="Script" uid="uid://cxnvqh8ijf0ox" path="res://src/scripts/player/boom.gd" id="2_qopur"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_yx56f"]
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_swhsd"]
|
||||
|
||||
[sub_resource type="SeparationRayShape3D" id="SeparationRayShape3D_swhsd"]
|
||||
|
||||
[node name="Player" type="CharacterBody3D"]
|
||||
script = ExtResource("1_swhsd")
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("CapsuleShape3D_yx56f")
|
||||
|
||||
[node name="Mesh" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("CapsuleMesh_swhsd")
|
||||
|
||||
[node name="Boom" type="SpringArm3D" parent="." node_paths=PackedStringArray("target")]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.866025, 0.5, 0, -0.5, 0.866025, 0, 1, 0)
|
||||
shape = SubResource("SeparationRayShape3D_swhsd")
|
||||
spring_length = 4.0
|
||||
script = ExtResource("2_qopur")
|
||||
target = NodePath("../HorizontalPivot/VerticalPivot")
|
||||
|
||||
[node name="Camera" type="Camera3D" parent="Boom"]
|
||||
|
||||
[node name="HorizontalPivot" type="Node3D" parent="."]
|
||||
|
||||
[node name="VerticalPivot" type="Node3D" parent="HorizontalPivot"]
|
||||
@ -1,32 +0,0 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://nsv4lbw7j8mi"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://csgybabwb8cbg" path="res://src/scripts/player/player.gd" id="1_swhsd"]
|
||||
[ext_resource type="Script" uid="uid://cxnvqh8ijf0ox" path="res://src/scripts/player/boom.gd" id="2_qopur"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_yx56f"]
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_swhsd"]
|
||||
|
||||
[sub_resource type="SeparationRayShape3D" id="SeparationRayShape3D_swhsd"]
|
||||
|
||||
[node name="Player" type="CharacterBody3D"]
|
||||
script = ExtResource("1_swhsd")
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("CapsuleShape3D_yx56f")
|
||||
|
||||
[node name="Mesh" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("CapsuleMesh_swhsd")
|
||||
|
||||
[node name="Boom" type="SpringArm3D" parent="." node_paths=PackedStringArray("target")]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.866025, 0.5, 0, -0.5, 0.866025, 0, 1, 0)
|
||||
shape = SubResource("SeparationRayShape3D_swhsd")
|
||||
spring_length = 4.0
|
||||
script = ExtResource("2_qopur")
|
||||
target = NodePath("../HorizontalPivot/VerticalPivot")
|
||||
|
||||
[node name="Camera" type="Camera3D" parent="Boom"]
|
||||
|
||||
[node name="HorizontalPivot" type="Node3D" parent="."]
|
||||
|
||||
[node name="VerticalPivot" type="Node3D" parent="HorizontalPivot"]
|
||||
7
src/scripts/characters/area_attack.gd
Normal file
7
src/scripts/characters/area_attack.gd
Normal file
@ -0,0 +1,7 @@
|
||||
extends ShapeCast3D
|
||||
|
||||
func deal_damage(damage: float) -> void:
|
||||
for collision_id in get_collision_count():
|
||||
var collider = get_collider(collision_id)
|
||||
if collider is Player or collider is Enemy:
|
||||
collider.health_component.take_damage(damage)
|
||||
1
src/scripts/characters/area_attack.gd.uid
Normal file
1
src/scripts/characters/area_attack.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://nekr2inm6vnq
|
||||
10
src/scripts/characters/attack_cast.gd
Normal file
10
src/scripts/characters/attack_cast.gd
Normal file
@ -0,0 +1,10 @@
|
||||
extends RayCast3D
|
||||
|
||||
func deal_damage() -> void:
|
||||
if !is_colliding():
|
||||
return
|
||||
|
||||
var collider = get_collider()
|
||||
if collider is Enemy:
|
||||
collider.health_component.take_damage(15.0)
|
||||
add_exception(collider)
|
||||
1
src/scripts/characters/attack_cast.gd.uid
Normal file
1
src/scripts/characters/attack_cast.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://blbnvx6pe37mc
|
||||
18
src/scripts/characters/dash.gd
Normal file
18
src/scripts/characters/dash.gd
Normal file
@ -0,0 +1,18 @@
|
||||
extends Node3D
|
||||
|
||||
@export var player: Player
|
||||
|
||||
@onready var timer: Timer = $Timer
|
||||
|
||||
var direction: Vector3 = Vector3.ZERO
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if not timer.is_stopped():
|
||||
return
|
||||
|
||||
if event.is_action_pressed("dash"):
|
||||
direction = player.get_movement_direction()
|
||||
if not direction.is_zero_approx():
|
||||
print("We can dash!")
|
||||
timer.start(1.0)
|
||||
|
||||
1
src/scripts/characters/dash.gd.uid
Normal file
1
src/scripts/characters/dash.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://ekvwb7r88vda
|
||||
34
src/scripts/characters/enemy.gd
Normal file
34
src/scripts/characters/enemy.gd
Normal file
@ -0,0 +1,34 @@
|
||||
extends CharacterBody3D
|
||||
class_name Enemy
|
||||
|
||||
@export var max_health: float = 20.0
|
||||
|
||||
@onready var rig: Node3D = $Rig
|
||||
@onready var health_component: HealthComponent = $HealthComponent
|
||||
@onready var collision_shape: CollisionShape3D = $CollisionShape3D
|
||||
@onready var player_detector: ShapeCast3D = $Rig/PlayerDetector
|
||||
@onready var area_attack: ShapeCast3D = $Rig/AreaAttack
|
||||
|
||||
func _ready() -> void:
|
||||
var mesh = rig.villager_meshes.pick_random()
|
||||
rig.set_active_mesh(mesh)
|
||||
health_component.update_max_health(max_health)
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if rig.is_idle():
|
||||
check_for_attacks()
|
||||
|
||||
func check_for_attacks() -> void:
|
||||
for collision_id in player_detector.get_collision_count():
|
||||
var collider = player_detector.get_collider(collision_id)
|
||||
if collider is Player:
|
||||
rig.playback.travel("Overhead")
|
||||
|
||||
func _on_health_component_defeat() -> void:
|
||||
rig.playback.travel("Defeat")
|
||||
collision_shape.disabled = true
|
||||
set_physics_process(false)
|
||||
|
||||
|
||||
func _on_rig_heavy_attack() -> void:
|
||||
area_attack.deal_damage(20.0)
|
||||
1
src/scripts/characters/enemy.gd.uid
Normal file
1
src/scripts/characters/enemy.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://p38hhb8jwgor
|
||||
20
src/scripts/characters/health_component.gd
Normal file
20
src/scripts/characters/health_component.gd
Normal file
@ -0,0 +1,20 @@
|
||||
extends Node
|
||||
class_name HealthComponent
|
||||
|
||||
signal defeat()
|
||||
signal health_changed()
|
||||
|
||||
var max_health: float
|
||||
var current_health: float:
|
||||
set(value):
|
||||
current_health = max(value, 0.0)
|
||||
if current_health == 0.0:
|
||||
defeat.emit()
|
||||
health_changed.emit()
|
||||
|
||||
func update_max_health(max_hp_in: float) -> void:
|
||||
max_health = max_hp_in
|
||||
current_health = max_health
|
||||
|
||||
func take_damage(damage_in: float) -> void:
|
||||
current_health -= damage_in
|
||||
1
src/scripts/characters/health_component.gd.uid
Normal file
1
src/scripts/characters/health_component.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://b80knj2xg2m76
|
||||
@ -1,4 +1,5 @@
|
||||
extends CharacterBody3D
|
||||
class_name Player
|
||||
|
||||
|
||||
const SPEED = 5.0
|
||||
@ -6,22 +7,36 @@ const JUMP_VELOCITY = 4.5
|
||||
|
||||
# Stores the x/y direction of the camera
|
||||
var _look := Vector2.ZERO
|
||||
# Stores the direction the player moves when attacking
|
||||
var _attack_direction: Vector3 = Vector3.ZERO
|
||||
|
||||
@export var mouse_sensitivity: float = 0.0075
|
||||
@export var camera_max_pitch: float = 25
|
||||
@export var camera_min_pitch: float = -75
|
||||
@export var animation_decay: float = 25.0
|
||||
@export var attack_move_speed: float = 3.0
|
||||
|
||||
@onready var horizontal_pivot: Node3D = $HorizontalPivot
|
||||
@onready var vertical_pivot: Node3D = $HorizontalPivot/VerticalPivot
|
||||
@onready var rig_pivot: Node3D = $RigPivot
|
||||
@onready var rig: Node3D = $RigPivot/Rig
|
||||
@onready var attack_cast: RayCast3D = %AttackCast
|
||||
@onready var health_component: HealthComponent = $HealthComponent
|
||||
@onready var collision_shape: CollisionShape3D = $CollisionShape
|
||||
@onready var area_attack: ShapeCast3D = $RigPivot/AreaAttack
|
||||
|
||||
func _ready() -> void:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
health_component.update_max_health(30.0)
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
frame_camera_rotation()
|
||||
var direction := get_movement_direction()
|
||||
rig.update_animation_tree(direction)
|
||||
handle_idle_physics_frame(delta, direction)
|
||||
handle_slashing_physics_frame(delta)
|
||||
handle_overhead_physics_frame()
|
||||
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
@ -30,16 +45,6 @@ func _physics_process(delta: float) -> void:
|
||||
if Input.is_action_just_pressed("move_jump") and is_on_floor():
|
||||
velocity.y = JUMP_VELOCITY
|
||||
|
||||
var direction := get_movement_direction()
|
||||
rig.update_animation_tree(direction)
|
||||
if direction:
|
||||
velocity.x = direction.x * SPEED
|
||||
velocity.z = direction.z * SPEED
|
||||
look_toward_direction(direction, delta)
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
velocity.z = move_toward(velocity.z, 0, SPEED)
|
||||
|
||||
move_and_slide()
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
@ -49,6 +54,11 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
|
||||
if event is InputEventMouseMotion:
|
||||
_look = -event.relative * mouse_sensitivity
|
||||
if rig.is_idle():
|
||||
if event.is_action_pressed("click"):
|
||||
slash_attack()
|
||||
if event.is_action_pressed("right_click"):
|
||||
heavy_attack()
|
||||
|
||||
func frame_camera_rotation() -> void:
|
||||
horizontal_pivot.rotate_y(_look.x)
|
||||
@ -67,3 +77,56 @@ func look_toward_direction(direction: Vector3, delta: float) -> void:
|
||||
rig_pivot.global_position + direction, Vector3.UP, true
|
||||
)
|
||||
rig_pivot.global_transform = rig_pivot.global_transform.interpolate_with(target_transform, 1.0 - exp(-animation_decay * delta))
|
||||
|
||||
func slash_attack() -> void:
|
||||
rig.playback.travel("Slash")
|
||||
var movement_direction = get_movement_direction()
|
||||
if movement_direction.is_zero_approx():
|
||||
_attack_direction = rig.global_basis * Vector3(0, 0, 1)
|
||||
else:
|
||||
_attack_direction = movement_direction
|
||||
attack_cast.clear_exceptions()
|
||||
|
||||
func heavy_attack() -> void:
|
||||
rig.playback.travel("Overhead")
|
||||
var movement_direction = get_movement_direction()
|
||||
if movement_direction.is_zero_approx():
|
||||
_attack_direction = rig.global_basis * Vector3(0, 0, 1)
|
||||
else:
|
||||
_attack_direction = movement_direction
|
||||
attack_cast.clear_exceptions()
|
||||
|
||||
func handle_idle_physics_frame(delta: float, direction: Vector3) -> void:
|
||||
if !rig.is_idle():
|
||||
return
|
||||
|
||||
if direction:
|
||||
velocity.x = direction.x * SPEED
|
||||
velocity.z = direction.z * SPEED
|
||||
look_toward_direction(direction, delta)
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
velocity.z = move_toward(velocity.z, 0, SPEED)
|
||||
|
||||
func handle_slashing_physics_frame(delta: float) -> void:
|
||||
if !rig.is_slashing():
|
||||
return
|
||||
|
||||
velocity.x = _attack_direction.x * attack_move_speed
|
||||
velocity.z = _attack_direction.z * attack_move_speed
|
||||
look_toward_direction(_attack_direction, delta)
|
||||
attack_cast.deal_damage()
|
||||
|
||||
func handle_overhead_physics_frame() -> void:
|
||||
if !rig.is_overhead():
|
||||
return
|
||||
velocity.x = 0.0
|
||||
velocity.z = 0.0
|
||||
|
||||
func _on_health_component_defeat() -> void:
|
||||
rig.playback.travel("Defeat")
|
||||
collision_shape.disabled = true
|
||||
set_physics_process(false)
|
||||
|
||||
func _on_rig_heavy_attack() -> void:
|
||||
area_attack.deal_damage(50.0)
|
||||
47
src/scripts/characters/rig.gd
Normal file
47
src/scripts/characters/rig.gd
Normal file
@ -0,0 +1,47 @@
|
||||
extends Node3D
|
||||
|
||||
signal heavy_attack()
|
||||
|
||||
@export var animation_speed: float = 10.0
|
||||
|
||||
@onready var animation_tree: AnimationTree = $AnimationTree
|
||||
@onready var playback: AnimationNodeStateMachinePlayback = animation_tree["parameters/playback"]
|
||||
@onready var skeleton_3d: Skeleton3D = $CharacterRig/GameRig/Skeleton3D
|
||||
@onready var villager_meshes: Array[MeshInstance3D] = [
|
||||
$CharacterRig/GameRig/Skeleton3D/Villager_01,
|
||||
$CharacterRig/GameRig/Skeleton3D/Villager_02
|
||||
]
|
||||
|
||||
var run_path: String = "parameters/MoveSpace/blend_position"
|
||||
var run_weight_target: float = -1.0
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
animation_tree[run_path] = move_toward(
|
||||
animation_tree[run_path],
|
||||
run_weight_target,
|
||||
delta * animation_speed
|
||||
)
|
||||
|
||||
func update_animation_tree(direction: Vector3) -> void:
|
||||
if direction.is_zero_approx():
|
||||
run_weight_target = -1.0
|
||||
else:
|
||||
run_weight_target = 1.0
|
||||
|
||||
func is_idle() -> bool:
|
||||
return playback.get_current_node() == "MoveSpace"
|
||||
|
||||
func is_slashing() -> bool:
|
||||
return playback.get_current_node() == "Slash"
|
||||
|
||||
func is_overhead() -> bool:
|
||||
return playback.get_current_node() == "Overhead"
|
||||
|
||||
func set_active_mesh(active_mesh: MeshInstance3D) -> void:
|
||||
for child in skeleton_3d.get_children():
|
||||
child.visible = false
|
||||
active_mesh.visible = true
|
||||
|
||||
func _on_animation_tree_animation_finished(anim_name: StringName) -> void:
|
||||
if anim_name == "Overhead":
|
||||
heavy_attack.emit()
|
||||
@ -1,21 +0,0 @@
|
||||
extends Node3D
|
||||
|
||||
@export var animation_speed: float = 10.0
|
||||
|
||||
@onready var animation_tree: AnimationTree = $AnimationTree
|
||||
|
||||
var run_path: String = "parameters/MoveSpace/blend_position"
|
||||
var run_weight_target: float = -1.0
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
animation_tree[run_path] = move_toward(
|
||||
animation_tree[run_path],
|
||||
run_weight_target,
|
||||
delta * animation_speed
|
||||
)
|
||||
|
||||
func update_animation_tree(direction: Vector3) -> void:
|
||||
if direction.is_zero_approx():
|
||||
run_weight_target = -1.0
|
||||
else:
|
||||
run_weight_target = 1.0
|
||||
Loading…
x
Reference in New Issue
Block a user