From 16d9e5d62cfe722a9b25fc629a458c2b4902f132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Mart=C3=ADnez=20Palacio?= Date: Tue, 3 Sep 2024 21:00:53 +0200 Subject: [PATCH] Improve movement input slightly --- Scripts/hiro_player.gd | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Scripts/hiro_player.gd b/Scripts/hiro_player.gd index 4189968..552caa7 100644 --- a/Scripts/hiro_player.gd +++ b/Scripts/hiro_player.gd @@ -27,7 +27,7 @@ func _ready() -> void: $AnimationTree.set("parameters/melee/2/blend_position", HEADINGS[initial_heading]) func _unhandled_input(event: InputEvent) -> void: - if Input.is_action_just_pressed("melee") and can_move: + if event.is_action_pressed("melee") and can_move: var animation_rng = randf_range(0, 1) $AnimationTree.set("parameters/melee/blend_position", animation_rng) $AnimationTree.set("parameters/conditions/melee", true) @@ -43,7 +43,6 @@ func get_input(): var vertical = Input.get_axis("up", "down") var horizontal = Input.get_axis("left", "right") var input_direction = Vector2(horizontal, vertical) - var input_angle = rad_to_deg(atan2(vertical,horizontal)) var test = xor(abs(input_direction.dot(Vector2.RIGHT)) > 0.5, abs(input_direction.dot(Vector2.UP)) > 0.5) @@ -58,8 +57,8 @@ func get_input(): if not can_move: input_direction = Vector2.ZERO - last_dpad[0] = Vector2.ZERO - last_dpad[1] = Vector2.ZERO + # last_dpad[0] = Vector2.ZERO + # last_dpad[1] = Vector2.ZERO velocity = input_direction * speed