From 9e958d187a3330238d973a26c0cff562e8ae8560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Mart=C3=ADnez=20Palacio?= Date: Wed, 11 Sep 2024 01:12:21 +0200 Subject: [PATCH] Have Hiro AI use random melee animations --- Scripts/hiro_ai.gd | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Scripts/hiro_ai.gd b/Scripts/hiro_ai.gd index 182b642..03a1567 100644 --- a/Scripts/hiro_ai.gd +++ b/Scripts/hiro_ai.gd @@ -132,6 +132,8 @@ func _on_animation_tree_animation_finished(anim_name): state_machine.send_event("hurt_complete") elif (anim_name.contains("kick") or anim_name.contains("punch")): if wants_to_melee: + var animation_rng = randf_range(0, 1) + anim_tree.set("parameters/melee/blend_position", animation_rng) anim_tree.set("parameters/conditions/melee", true) else: state_machine.send_event("melee_complete") @@ -183,8 +185,8 @@ func _on_meleebox_body_entered(body): state_machine.send_event("will_melee") func _on_melee_state_entered(): - state_machine.set_expression_property("melee_stage", 0) anim_tree.set("parameters/conditions/melee", true) + state_machine.set_expression_property("melee_stage", 0) func _on_meleebox_body_exited(body): if body == player_character: