feat: adjusted player attacks
This commit is contained in:
parent
f304ef6819
commit
87ce61703b
7 changed files with 46 additions and 11 deletions
Binary file not shown.
Binary file not shown.
|
|
@ -9,9 +9,8 @@ var anim_started := false
|
|||
|
||||
func _enter():
|
||||
anim_started = false
|
||||
anim.play(attack_name, .1)
|
||||
anim.play(attack_name, .0)
|
||||
anim.advance(0)
|
||||
body.velocity = Vector3()
|
||||
|
||||
func _execute() -> int:
|
||||
if anim.current_animation == attack_name:
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[ext_resource type="PackedScene" uid="uid://hirlnhjbqv2u" path="res://assets/characters/bot.blend" id="1_eqqp1"]
|
||||
[ext_resource type="Script" uid="uid://yhqui7k36cuo" path="res://behaviours/consume_jab.gd" id="2_uxov2"]
|
||||
[ext_resource type="Script" uid="uid://bp4utstetxnhr" path="res://behaviours/attack.gd" id="2_ykyjo"]
|
||||
[ext_resource type="Script" uid="uid://bp4utstetxnhr" path="res://behaviours/animate.gd" id="2_ykyjo"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_eqqp1"]
|
||||
script/source = "extends CharacterBody3D
|
||||
|
|
@ -24,7 +24,7 @@ func _unhandled_input(event : InputEvent):
|
|||
resource_name = "PlayerMovement"
|
||||
script/source = "extends BehaviourAction
|
||||
|
||||
var speed := 10.
|
||||
var max_rotation_per_second : float = 15
|
||||
|
||||
var input : Vector2 = Vector2()
|
||||
@onready var body : CharacterBody3D = owner as CharacterBody3D
|
||||
|
|
@ -44,7 +44,10 @@ func _execute() -> int:
|
|||
var camera_basis : Basis = get_viewport().get_camera_3d().global_basis
|
||||
var flat_x := Vector3(camera_basis.x.x, 0, camera_basis.x.z).normalized()
|
||||
var flat_z := Vector3(camera_basis.z.x, 0, camera_basis.z.z).normalized()
|
||||
body.look_at(body.global_position + (flat_x * input.x + flat_z * input.y).normalized() * speed)
|
||||
var direction := flat_x * input.x + flat_z * input.y;
|
||||
var total_delta := body.global_basis.z.signed_angle_to(-direction, Vector3.UP)
|
||||
var max_rotation := get_process_delta_time() * max_rotation_per_second
|
||||
body.rotate_y(clampf(total_delta, -max_rotation, max_rotation))
|
||||
anim.play(\"run\", .1)
|
||||
return Success
|
||||
"
|
||||
|
|
@ -54,7 +57,7 @@ resource_name = "PlayerIdle"
|
|||
script/source = "extends BehaviourAction
|
||||
|
||||
func _execute() -> int:
|
||||
%AnimationPlayer.play(\"RESET\", .1)
|
||||
%AnimationPlayer.play(\"ready\", .1)
|
||||
(owner as CharacterBody3D).velocity = Vector3()
|
||||
return Success
|
||||
"
|
||||
|
|
@ -62,7 +65,10 @@ func _execute() -> int:
|
|||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_eqqp1"]
|
||||
radius = 0.30371094
|
||||
|
||||
[node name="bot" unique_id=1837890581 instance=ExtResource("1_eqqp1")]
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_uxov2"]
|
||||
size = Vector3(0.33496094, 0.4033203, 0.26367188)
|
||||
|
||||
[node name="bot" unique_id=807930453 instance=ExtResource("1_eqqp1")]
|
||||
script = SubResource("GDScript_eqqp1")
|
||||
|
||||
[node name="BehaviourTree" type="BehaviourTree" parent="." index="0" unique_id=2108584329]
|
||||
|
|
@ -91,7 +97,7 @@ script = ExtResource("2_uxov2")
|
|||
|
||||
[node name="Jab3" type="BehaviourAction" parent="BehaviourTree/BehaviourRepeater/BehaviourSelector/SequenceJabChain" index="5" unique_id=217672683]
|
||||
script = ExtResource("2_ykyjo")
|
||||
attack_name = "uppercut_1"
|
||||
attack_name = "hook_1"
|
||||
|
||||
[node name="Movement" type="BehaviourAction" parent="BehaviourTree/BehaviourRepeater/BehaviourSelector" index="1" unique_id=838466796]
|
||||
script = SubResource("GDScript_ykyjo")
|
||||
|
|
@ -102,7 +108,32 @@ script = SubResource("GDScript_uxov2")
|
|||
[node name="PhysicsShape" type="CollisionShape3D" parent="." index="1" unique_id=1611683515]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
shape = SubResource("CapsuleShape3D_eqqp1")
|
||||
debug_color = Color(0, 0.6, 0.69803923, 1)
|
||||
|
||||
[node name="AnimationPlayer" parent="." index="3" unique_id=1418577890]
|
||||
[node name="HandR" type="BoneAttachment3D" parent="Character/Skeleton3D" parent_id_path=PackedInt32Array(1974662018) 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
|
||||
|
||||
[node name="Area3D" type="Area3D" parent="Character/Skeleton3D/HandR" index="0" unique_id=1170013417]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Character/Skeleton3D/HandR/Area3D" index="0" unique_id=580766922]
|
||||
transform = Transform3D(1.0000031, -3.5762787e-07, 0, -1.1920929e-07, 1.0000023, 4.656613e-10, -5.5879354e-09, 4.90807e-07, 1, 9.432435e-05, 0.09994143, -3.59118e-05)
|
||||
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(1974662018) 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
|
||||
|
||||
[node name="Area3D" type="Area3D" parent="Character/Skeleton3D/HandL" index="0" unique_id=552609571]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Character/Skeleton3D/HandL/Area3D" index="0" unique_id=513165671]
|
||||
transform = Transform3D(1.0000169, -1.5944242e-06, -4.04194e-07, 6.556511e-07, 1.0000216, -4.172325e-07, -2.7939663e-08, 8.046625e-07, 1.0000148, -4.815308e-05, 0.09992814, 0.00016999245)
|
||||
shape = SubResource("BoxShape3D_uxov2")
|
||||
debug_color = Color(0.9966913, 0, 0.17880186, 1)
|
||||
|
||||
[node name="AnimationPlayer" parent="." index="3" unique_id=1761461954]
|
||||
unique_name_in_owner = true
|
||||
root_motion_track = NodePath("Character/Skeleton3D:root")
|
||||
|
|
|
|||
|
|
@ -46,3 +46,7 @@ jab={
|
|||
"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":74,"key_label":0,"unicode":106,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
3d/physics_engine="Jolt Physics"
|
||||
|
|
|
|||
|
|
@ -24,9 +24,10 @@ transform = Transform3D(-0.8660254, -0.43301278, 0.25, 0, 0.49999997, 0.86602545
|
|||
shadow_enabled = true
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="." unique_id=473807903]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.9745818, 0.22403194, 0, -0.22403194, 0.9745818, 0, 2.2971687, 2.3854582)
|
||||
transform = Transform3D(1, 0, 0, 0, 0.9577711, 0.28753164, 0, -0.28753164, 0.9577711, 0, 12.772846, 37.495686)
|
||||
fov = 24.81873
|
||||
|
||||
[node name="bot" parent="." unique_id=785214787 instance=ExtResource("1_upt1h")]
|
||||
[node name="bot" parent="." unique_id=2030034290 instance=ExtResource("1_upt1h")]
|
||||
|
||||
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="." unique_id=1773598072]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue