feat: animations and AI adjustments&sweep attack
This commit is contained in:
parent
10056bb847
commit
bdb767e723
23 changed files with 4228 additions and 43 deletions
|
|
@ -13,9 +13,8 @@ signal damaged(amount : int, source : Node3D)
|
|||
|
||||
@export var health : int = 6
|
||||
|
||||
var hurt_high : bool = false
|
||||
@onready var anim := %AnimationPlayer as AnimationPlayer
|
||||
|
||||
var hurt_high : bool = false
|
||||
var target : Node3D = null
|
||||
|
||||
func _ready():
|
||||
|
|
@ -29,12 +28,13 @@ func _damaged(amount : int, source : Node3D):
|
|||
func _physics_process(delta : float):
|
||||
var motion := anim.get_root_motion_position()
|
||||
velocity = (motion.x * global_basis.x + motion.z * global_basis.z) / delta
|
||||
velocity += get_gravity() * delta
|
||||
move_and_slide()
|
||||
|
||||
func find_targets() -> Array[Node3D]:
|
||||
return $AwarenessArea.aware
|
||||
|
||||
func attack_possible() -> bool:
|
||||
func wants_jab_attack() -> bool:
|
||||
return target and target.global_position.distance_to(global_position) < 1.5
|
||||
"
|
||||
|
||||
|
|
@ -42,24 +42,24 @@ func attack_possible() -> bool:
|
|||
albedo_color = Color(0.36862746, 0.5686275, 1, 1)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_we7g8"]
|
||||
size = Vector3(0.33496094, 0.23144531, 0.26367188)
|
||||
size = Vector3(0.33496094, 0.5253906, 0.26367188)
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_882u1"]
|
||||
radius = 0.33984375
|
||||
radius = 0.2133789
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_we7g8"]
|
||||
height = 1.296875
|
||||
radius = 5.7021484
|
||||
|
||||
[node name="bot" unique_id=250133973 groups=["EnemyHitbox"] instance=ExtResource("1_882u1")]
|
||||
[node name="bot" unique_id=49523271 groups=["EnemyHitbox"] instance=ExtResource("1_882u1")]
|
||||
collision_layer = 2
|
||||
collision_mask = 3
|
||||
script = SubResource("GDScript_882u1")
|
||||
|
||||
[node name="Mesh" parent="Character/Skeleton3D" parent_id_path=PackedInt32Array(706042794) index="0" unique_id=1499137314]
|
||||
[node name="Mesh" parent="Character/Skeleton3D" parent_id_path=PackedInt32Array(1548948889) index="0" unique_id=1839254735]
|
||||
material_override = SubResource("StandardMaterial3D_41oev")
|
||||
|
||||
[node name="HandR" type="BoneAttachment3D" parent="Character/Skeleton3D" parent_id_path=PackedInt32Array(706042794) index="1" unique_id=957498611]
|
||||
[node name="HandR" type="BoneAttachment3D" parent="Character/Skeleton3D" parent_id_path=PackedInt32Array(1548948889) index="1" unique_id=957498611]
|
||||
transform = Transform3D(0.015967373, -0.083946444, 0.9963424, -0.17989334, -0.98045003, -0.07972447, 0.9835564, -0.17796235, -0.030756809, 0.27221423, 0.7951686, 0.024477992)
|
||||
bone_name = "hand.r"
|
||||
bone_idx = 10
|
||||
|
|
@ -74,11 +74,11 @@ source = NodePath("../../../..")
|
|||
damage_group = "PlayerHitbox"
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Character/Skeleton3D/HandR/DamageAreaR" index="0" unique_id=1459089003]
|
||||
transform = Transform3D(1.0000031, -3.5762787e-07, 1.4210855e-14, -1.1920929e-07, 1.0000023, -1.49011585e-08, -5.5879497e-09, 4.917384e-07, 1, 9.4322706e-05, 0.101888776, -0.010492921)
|
||||
transform = Transform3D(1.0000031, -4.61936e-07, -9.126961e-08, -1.1920929e-07, 1.0000024, 1.8626451e-09, -7.4505806e-08, 4.703179e-07, 1, 9.433925e-05, 0.10188866, -0.010492891)
|
||||
shape = SubResource("BoxShape3D_we7g8")
|
||||
debug_color = Color(0.9966913, 0, 0.17880186, 1)
|
||||
|
||||
[node name="HandL" type="BoneAttachment3D" parent="Character/Skeleton3D" parent_id_path=PackedInt32Array(706042794) index="2" unique_id=1761081841]
|
||||
[node name="HandL" type="BoneAttachment3D" parent="Character/Skeleton3D" parent_id_path=PackedInt32Array(1548948889) index="2" unique_id=1761081841]
|
||||
transform = Transform3D(-0.039434362, 0.07924447, -0.9960749, 0.12679999, -0.9883944, -0.083653376, -0.99114394, -0.12960118, 0.028928574, -0.2710728, 0.7714727, 0.0945672)
|
||||
bone_name = "hand.l"
|
||||
bone_idx = 7
|
||||
|
|
@ -97,7 +97,7 @@ transform = Transform3D(1.0000169, -1.5795231e-06, -3.874302e-07, 8.046627e-07,
|
|||
shape = SubResource("BoxShape3D_we7g8")
|
||||
debug_color = Color(0.9966913, 0, 0.17880186, 1)
|
||||
|
||||
[node name="AnimationPlayer" parent="." index="1" unique_id=445797329]
|
||||
[node name="AnimationPlayer" parent="." index="1" unique_id=245226940]
|
||||
unique_name_in_owner = true
|
||||
root_motion_track = NodePath("Character/Skeleton3D:root")
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ script/source = "extends CharacterBody3D
|
|||
|
||||
signal damaged(amount : int, source : Node3D)
|
||||
|
||||
var attack_queued : bool = false
|
||||
var jab_queued : bool = false
|
||||
var sweep_queued : bool = false
|
||||
var hurt_high : bool = false
|
||||
var target : Node3D = null
|
||||
|
||||
|
|
@ -23,12 +24,19 @@ func _damaged(_amount : int, source : Node3D):
|
|||
|
||||
func _physics_process(delta: float):
|
||||
var root_velocity : Vector3 = %AnimationPlayer.get_root_motion_position() / delta
|
||||
velocity = (global_basis.x * root_velocity.x + global_basis.z * root_velocity.z)
|
||||
var y_velocity := velocity.y
|
||||
velocity = global_basis.x * root_velocity.x + global_basis.z * root_velocity.z
|
||||
velocity.y = y_velocity
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
move_and_slide()
|
||||
|
||||
func _unhandled_input(event : InputEvent):
|
||||
if event.is_action_pressed(\"jab\"):
|
||||
attack_queued = true
|
||||
jab_queued = true
|
||||
get_viewport().set_input_as_handled()
|
||||
elif event.is_action_pressed(\"sweep\"):
|
||||
sweep_queued = true
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
func is_valid_target(node : Node3D) -> bool:
|
||||
|
|
@ -37,21 +45,30 @@ func is_valid_target(node : Node3D) -> bool:
|
|||
func find_targets() -> Array[Node3D]:
|
||||
return $AwarenessArea.aware.filter(is_valid_target)
|
||||
|
||||
func attack_possible() -> bool:
|
||||
if attack_queued:
|
||||
attack_queued = false
|
||||
func wants_jab_attack() -> bool:
|
||||
if jab_queued:
|
||||
jab_queued = false
|
||||
return true
|
||||
return false
|
||||
|
||||
func wants_sweep_attack() -> bool:
|
||||
if sweep_queued:
|
||||
sweep_queued = false
|
||||
return true
|
||||
return false
|
||||
"
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_eqqp1"]
|
||||
radius = 0.30371094
|
||||
radius = 0.21240234
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_f46kd"]
|
||||
albedo_color = Color(0.8666667, 0.22352941, 0.41568628, 1)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_uxov2"]
|
||||
size = Vector3(0.33496094, 0.19042969, 0.26367188)
|
||||
size = Vector3(0.33496094, 0.6435547, 0.26367188)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_nmc1l"]
|
||||
size = Vector3(0.33496094, 0.8294678, 0.4711914)
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_nmc1l"]
|
||||
resource_name = "CameraPivot"
|
||||
|
|
@ -77,7 +94,7 @@ func _process(_delta):
|
|||
[sub_resource type="SphereShape3D" id="SphereShape3D_nmc1l"]
|
||||
radius = 0.3
|
||||
|
||||
[node name="bot" unique_id=1726366668 groups=["PlayerHitbox"] instance=ExtResource("1_eqqp1")]
|
||||
[node name="bot" unique_id=162481247 groups=["PlayerHitbox"] instance=ExtResource("1_eqqp1")]
|
||||
collision_layer = 2
|
||||
collision_mask = 3
|
||||
script = SubResource("GDScript_eqqp1")
|
||||
|
|
@ -93,10 +110,10 @@ debug_color = Color(0, 0.6, 0.69803923, 1)
|
|||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.0963671, 0)
|
||||
target_group = "EnemyHitbox"
|
||||
|
||||
[node name="Mesh" parent="Character/Skeleton3D" parent_id_path=PackedInt32Array(1931156214) index="0" unique_id=613701145]
|
||||
[node name="Mesh" parent="Character/Skeleton3D" parent_id_path=PackedInt32Array(937444697) index="0" unique_id=1897762821]
|
||||
material_override = SubResource("StandardMaterial3D_f46kd")
|
||||
|
||||
[node name="HandR" type="BoneAttachment3D" parent="Character/Skeleton3D" parent_id_path=PackedInt32Array(1931156214) index="1" unique_id=385862689]
|
||||
[node name="HandR" type="BoneAttachment3D" parent="Character/Skeleton3D" parent_id_path=PackedInt32Array(937444697) index="1" unique_id=385862689]
|
||||
transform = Transform3D(0.015967373, -0.083946444, 0.9963424, -0.17989334, -0.98045003, -0.07972447, 0.9835564, -0.17796235, -0.030756809, 0.27221423, 0.7951686, 0.024477992)
|
||||
bone_name = "hand.r"
|
||||
bone_idx = 10
|
||||
|
|
@ -110,11 +127,11 @@ script = ExtResource("4_nmc1l")
|
|||
source = NodePath("../../../..")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Character/Skeleton3D/HandR/DamageAreaR" index="0" unique_id=580766922]
|
||||
transform = Transform3D(1.0000031, -4.61936e-07, -8.940697e-08, -1.1920929e-07, 1.0000024, 1.3969839e-09, -7.264316e-08, 4.703179e-07, 1, 9.433925e-05, 0.10188866, -0.010492891)
|
||||
transform = Transform3D(1.0000031, -4.6193608e-07, -8.9406996e-08, -1.1920928e-07, 1.0000017, -3.5762787e-07, -7.264316e-08, 4.3213376e-07, 0.99999887, 9.4339266e-05, 0.10188866, -0.010492921)
|
||||
shape = SubResource("BoxShape3D_uxov2")
|
||||
debug_color = Color(0.9966913, 0, 0.17880186, 1)
|
||||
|
||||
[node name="HandL" type="BoneAttachment3D" parent="Character/Skeleton3D" parent_id_path=PackedInt32Array(1931156214) index="2" unique_id=279793409]
|
||||
[node name="HandL" type="BoneAttachment3D" parent="Character/Skeleton3D" parent_id_path=PackedInt32Array(937444697) index="2" unique_id=279793409]
|
||||
transform = Transform3D(-0.039434362, 0.07924447, -0.9960749, 0.12679999, -0.9883944, -0.083653376, -0.99114394, -0.12960118, 0.028928574, -0.2710728, 0.7714727, 0.0945672)
|
||||
bone_name = "hand.l"
|
||||
bone_idx = 7
|
||||
|
|
@ -132,7 +149,25 @@ transform = Transform3D(1.0000169, -1.5944242e-06, -4.04194e-07, 6.556511e-07, 1
|
|||
shape = SubResource("BoxShape3D_uxov2")
|
||||
debug_color = Color(0.9966913, 0, 0.17880186, 1)
|
||||
|
||||
[node name="AnimationPlayer" parent="." index="4" unique_id=951425454]
|
||||
[node name="LegR" type="BoneAttachment3D" parent="Character/Skeleton3D" parent_id_path=PackedInt32Array(937444697) index="3" unique_id=2088257762]
|
||||
transform = Transform3D(0.9947343, 0.10095803, 0.017639676, 0.10222586, -0.98967797, -0.1004331, 0.0073180734, 0.1017075, -0.9947873, 0.14436838, 0.42896914, -0.076926425)
|
||||
bone_name = "leg.lower.r"
|
||||
bone_idx = 14
|
||||
|
||||
[node name="DamageAreaLegR" type="Area3D" parent="Character/Skeleton3D/LegR" index="0" unique_id=744767490 node_paths=PackedStringArray("source")]
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
monitoring = false
|
||||
monitorable = false
|
||||
script = ExtResource("4_nmc1l")
|
||||
source = NodePath("../../../..")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Character/Skeleton3D/LegR/DamageAreaLegR" index="0" unique_id=836699763]
|
||||
transform = Transform3D(1.0000174, -1.6069971e-06, -1.4901161e-07, 5.9604645e-07, 1.000027, -2.0861623e-07, 1.0579823e-06, 1.0393561e-06, 1.0000147, -4.7951937e-05, 0.19483443, -0.114048116)
|
||||
shape = SubResource("BoxShape3D_nmc1l")
|
||||
debug_color = Color(0.9966913, 0, 0.17880186, 1)
|
||||
|
||||
[node name="AnimationPlayer" parent="." index="4" unique_id=2139879921]
|
||||
unique_name_in_owner = true
|
||||
root_motion_track = NodePath("Character/Skeleton3D:root")
|
||||
|
||||
|
|
@ -141,10 +176,10 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.3769674, 0)
|
|||
script = SubResource("GDScript_nmc1l")
|
||||
|
||||
[node name="SpringArm3D" type="SpringArm3D" parent="CameraPivot" index="0" unique_id=1656112632]
|
||||
transform = Transform3D(0.9698174, 0, 0.24383235, 0, 1, 0, -0.24383235, 0, 0.9698174, 0.06544638, 0.66225195, 0)
|
||||
transform = Transform3D(0.9981222, 0, 0.061254278, 0, 1, 0, -0.061254278, 0, 0.9981222, 0.06544638, 0.66225195, 0)
|
||||
shape = SubResource("SphereShape3D_nmc1l")
|
||||
spring_length = 3.0
|
||||
spring_length = 4.0
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="CameraPivot/SpringArm3D" index="0" unique_id=552400396]
|
||||
transform = Transform3D(0.9664448, 0.056318317, -0.25062487, 0, 0.97567, 0.2192444, 0.25687462, -0.21188758, 0.9429312, 0, 0, 0)
|
||||
transform = Transform3D(0.9979606, -5.2219344e-12, -0.0638317, 5.2317426e-12, 1, -1.2884713e-14, 0.0638317, -3.204676e-13, 0.9979606, 0, 0, 0)
|
||||
fov = 52.5
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue