Improve movement input slightly

This commit is contained in:
Mario Martínez 2024-09-03 21:00:53 +02:00
parent b7fb3bbb23
commit 16d9e5d62c

View file

@ -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