From 31529ecbd422677a4f8d1363b858b5e656112847 Mon Sep 17 00:00:00 2001 From: Raxki Date: Wed, 18 Sep 2024 14:53:30 -0400 Subject: [PATCH] Fix Hiro player freezing after melee animation end --- Hiro/hiro_animation.tres | 24 ++++++++++++------------ Hiro/hiro_player.tscn | 6 ++++-- Scripts/hiro_player.gd | 1 + 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Hiro/hiro_animation.tres b/Hiro/hiro_animation.tres index 00fcfd2..8e6f749 100644 --- a/Hiro/hiro_animation.tres +++ b/Hiro/hiro_animation.tres @@ -565,7 +565,7 @@ tracks/3/keys = { } tracks/4/type = "value" tracks/4/imported = false -tracks/4/enabled = true +tracks/4/enabled = false tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee") tracks/4/interp = 1 tracks/4/loop_wrap = true @@ -654,7 +654,7 @@ tracks/3/keys = { } tracks/4/type = "value" tracks/4/imported = false -tracks/4/enabled = true +tracks/4/enabled = false tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee") tracks/4/interp = 1 tracks/4/loop_wrap = true @@ -743,7 +743,7 @@ tracks/3/keys = { } tracks/4/type = "value" tracks/4/imported = false -tracks/4/enabled = true +tracks/4/enabled = false tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee") tracks/4/interp = 1 tracks/4/loop_wrap = true @@ -832,7 +832,7 @@ tracks/3/keys = { } tracks/4/type = "value" tracks/4/imported = false -tracks/4/enabled = true +tracks/4/enabled = false tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee") tracks/4/interp = 1 tracks/4/loop_wrap = true @@ -921,7 +921,7 @@ tracks/3/keys = { } tracks/4/type = "value" tracks/4/imported = false -tracks/4/enabled = true +tracks/4/enabled = false tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee") tracks/4/interp = 1 tracks/4/loop_wrap = true @@ -1010,7 +1010,7 @@ tracks/3/keys = { } tracks/4/type = "value" tracks/4/imported = false -tracks/4/enabled = true +tracks/4/enabled = false tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee") tracks/4/interp = 1 tracks/4/loop_wrap = true @@ -1099,7 +1099,7 @@ tracks/3/keys = { } tracks/4/type = "value" tracks/4/imported = false -tracks/4/enabled = true +tracks/4/enabled = false tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee") tracks/4/interp = 1 tracks/4/loop_wrap = true @@ -1188,7 +1188,7 @@ tracks/3/keys = { } tracks/4/type = "value" tracks/4/imported = false -tracks/4/enabled = true +tracks/4/enabled = false tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee") tracks/4/interp = 1 tracks/4/loop_wrap = true @@ -1277,7 +1277,7 @@ tracks/3/keys = { } tracks/4/type = "value" tracks/4/imported = false -tracks/4/enabled = true +tracks/4/enabled = false tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee") tracks/4/interp = 1 tracks/4/loop_wrap = true @@ -1366,7 +1366,7 @@ tracks/3/keys = { } tracks/4/type = "value" tracks/4/imported = false -tracks/4/enabled = true +tracks/4/enabled = false tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee") tracks/4/interp = 1 tracks/4/loop_wrap = true @@ -1455,7 +1455,7 @@ tracks/3/keys = { } tracks/4/type = "value" tracks/4/imported = false -tracks/4/enabled = true +tracks/4/enabled = false tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee") tracks/4/interp = 1 tracks/4/loop_wrap = true @@ -1544,7 +1544,7 @@ tracks/3/keys = { } tracks/4/type = "value" tracks/4/imported = false -tracks/4/enabled = true +tracks/4/enabled = false tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee") tracks/4/interp = 1 tracks/4/loop_wrap = true diff --git a/Hiro/hiro_player.tscn b/Hiro/hiro_player.tscn index 580315e..1c7a4c7 100644 --- a/Hiro/hiro_player.tscn +++ b/Hiro/hiro_player.tscn @@ -167,8 +167,8 @@ advance_mode = 2 advance_condition = &"melee" [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_l17k0"] +switch_mode = 2 advance_mode = 2 -advance_expression = "get(\"parameters/conditions/melee\") == false" [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ln3pc"] switch_mode = 2 @@ -186,7 +186,7 @@ states/melee/position = Vector2(329, 224) states/walk/node = SubResource("AnimationNodeBlendSpace2D_vunsg") states/walk/position = Vector2(520, 108) transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition_akmuq"), "idle", "walk", SubResource("AnimationNodeStateMachineTransition_sn1tm"), "walk", "idle", SubResource("AnimationNodeStateMachineTransition_5i3fu"), "idle", "melee", SubResource("AnimationNodeStateMachineTransition_y8p74"), "melee", "idle", SubResource("AnimationNodeStateMachineTransition_l17k0"), "hurt", "idle", SubResource("AnimationNodeStateMachineTransition_ln3pc")] -graph_offset = Vector2(-258, -59) +graph_offset = Vector2(-241, 18) [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_vm050"] radius = 8.0 @@ -225,6 +225,7 @@ parameters/melee/2/blend_position = Vector2(0, 0) parameters/walk/blend_position = Vector2(-0.0100167, -0.0729166) [node name="Hitbox" type="Area2D" parent="."] +visible = false position = Vector2(0, 1) collision_layer = 2 collision_mask = 10 @@ -235,6 +236,7 @@ shape = SubResource("CapsuleShape2D_vm050") debug_color = Color(1, 0.133333, 0.321569, 0.419608) [node name="MovementCollider" type="CollisionShape2D" parent="."] +visible = false position = Vector2(-0.5, -1) shape = SubResource("RectangleShape2D_bdqvd") diff --git a/Scripts/hiro_player.gd b/Scripts/hiro_player.gd index 82926cd..34c7ba1 100644 --- a/Scripts/hiro_player.gd +++ b/Scripts/hiro_player.gd @@ -102,5 +102,6 @@ func _on_enemy_attack_did_hit(other, power, attack_direction): func _on_animation_tree_animation_finished(anim_name): if anim_name.contains("hurt") or anim_name.contains("kick") or anim_name.contains("punch"): can_move = true + $AnimationTree.set("parameters/conditions/melee", false) if anim_name.contains("kick") or anim_name.contains("punch"): $Attackbox/Collider.set_deferred("disabled", true)