Broken Character controller

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Deadtuna

So I was working on redoing my sprite from an AnimatedSprite2D to a Sprite2D that uses a AnimationPlayer for greater control for allowing multiple weapon pickups and such; however, after I made the update, the controller broke.
I copy pasted the code into a different CharacterBody2D and replicated what I had before I updated to the AnimationPlayer and the code seemed to work fine there.
The issue is the code no longer works for my updated character which is strange.

here is the main code:
func _physics_process(_delta):

#Movement
var directionLR = Input.get_axis(“walk_left”, “walk_right”)
if directionLR:
velocity.x = directionLR * SPEED
else:
velocity.x = 0
var directionUD = Input.get_axis(“walk_up”, “walk_down”)
if directionUD:
velocity.y = directionUD * SPEED
else:
velocity.y = 0
move_and_slide()

#Animations
if Input.is_action_just_pressed(“attack”) and Input.get_axis(“walk_left”, “walk_right”) or Input.is_action_just_pressed(“attack”) and Input.get_axis(“walk_up”, “walk_down”):
#Attack Animation
$Sprites/AnimationPlayer.play(“walk_and_attack”)
if Input.is_action_just_pressed(“attack”):
$Sprites/AnimationPlayer.play(“attack”)
if Input.get_axis(“walk_left”, “walk_right”) or Input.get_axis(“walk_left”, “walk_right”) and Input.is_action_just_released(“attack”) or Input.get_axis(“walk_up”, “walk_down”) or Input.get_axis(“walk_up”, “walk_down”) and Input.is_action_just_released(“attack”):
#Run animation
$Sprites/AnimationPlayer.play(“walk”)
elif Input.is_action_just_released(“attack”) or Input.is_action_just_released(“walk_left”) or Input.is_action_just_released(“walk_right”) or Input.is_action_just_released(“walk_up”) or Input.is_action_just_released(“walk_down”):
#Idle Animation
$Sprites/AnimationPlayer.play(“idle”)
else:
$Sprites/AnimationPlayer.play(“idle”)

:bust_in_silhouette: Reply From: Moreus

Make Debug Logs with print

You can check all variables and loops