help with animations

Godot Version

4.5.1

Question

i need some help i am new to godot and am trying to code animation however my jump won’t work my walk still happens after jumping and my saber animation only partially play but only in air and i am lost any help is much appreciated


@export var walk_speed = 250
@export var run_speed = 400
@export_range(0, 1) var acceleration = 0.1
@export_range(0, 1) var decceleration = 0.1
var is_wall_sliding = false
const friction = 10
@export var jump_force = -600
@export_range(0, 1) var deccelerate_on_jump_release = 0.5
@onready var animated_sprite = $AnimatedSprite2D
const wall_jump_pushback = 200
var is_running = false
var is_sprinting = false
var speed = 0
var is_waliking = false
var is_jumping = false
var is_falling = false
var is_saber_used = false
var idle = false
func _physics_process(delta: float) -> void:
	# Add the gravity.
	if not is_on_floor():
		velocity += get_gravity() * delta

	


	var _speed
	if Input.is_action_pressed("run"):
		speed = run_speed
		animated_sprite.speed_scale = 1.5
	else:
		speed = walk_speed
		animated_sprite.speed_scale = 1

	if Input.is_action_just_pressed("saber"):
			idle = false
			is_waliking = false
			is_saber_used = true


# Handle jump.
	if Input.is_action_just_pressed("jump") and is_on_floor():
		velocity.y += jump_force
	
	if Input.is_action_just_released("jump") and velocity.y < 0:
		velocity.y *= deccelerate_on_jump_release
	# Get the input direction and handle the movement/deceleration.
	# As good practice, you should replace UI actions with custom gameplay actions.
	var direction := Input.get_axis("move_left", "move_right")
	if direction:
		velocity.x = move_toward(velocity.x, direction * speed, speed * acceleration) 
		animated_sprite.flip_h = direction < 0 
		idle = false
		if is_on_floor():
			is_waliking = true
	else:
		velocity.x = move_toward(velocity.x,0, walk_speed * decceleration)
	if Input.is_action_just_pressed("jump") and is_on_wall():
		velocity.y = jump_force 
		velocity.x = wall_jump_pushback * direction * -1
	
	if velocity.x == 0 and velocity.y == 0:
			is_waliking = false
			idle = true
	if !is_on_floor():
		is_waliking = false

	
	
	if !is_on_floor() and velocity.y < 0:
		is_jumping = true
		is_falling = false		
	if !is_on_floor() and velocity.y > 0:
		is_falling = true
		is_jumping = false
	if is_on_floor():
		is_falling = false 
		is_jumping = false
	
	if is_waliking == true:
		animated_sprite.play("regular run")
	if is_falling == true:
		animated_sprite.play("fall")
	if is_falling == true:
		animated_sprite.play("jump")
	if idle == true:
		animated_sprite.play("idle")
	if is_saber_used == true:
		animated_sprite.play("saber ground")
	move_and_slide()

I highly suggest you to check how state machines work in Godot and try to implement one into your project.

Alright thanks