That's what I figured might be going on, but I just don't know how to fix it.
As you said, I moved all my animation code to a process update. Don't know if this'll help or not, but here's my entire code right now:
extends KinematicBody2D
const SPEED = 500
const GRAVITY = 40
const JUMP = -1500
const FLOOR = Vector2(0, -1)
var velocity = Vector2()
var on_ground = false
var crouched = false
var attacking = false
var defending = false
func physicsprocess(delta):
#MOVEMENT
if Input.is_action_pressed("ui_right"):
if attacking == false:
if crouched == false:
if defending == false:
velocity.x = SPEED
elif Input.is_action_pressed("ui_left"):
if attacking == false:
if crouched == false:
if defending == false:
velocity.x = -SPEED
else:
velocity.x = 0
#JUMP
if Input.is_action_just_pressed("ui_select"):
if on_ground == true:
velocity.y = JUMP
on_ground = false
velocity.y += GRAVITY
velocity = move_and_slide(velocity, FLOOR)
#ATTACK
if Input.is_action_just_pressed("attack"):
if defending == false:
attacking = true
velocity.x = 0
else:
attacking = false
#CROUCH
if Input.is_action_pressed("ui_down"):
if on_ground == true:
if attacking == false:
velocity.x = 0
crouched = true
else:
crouched = false
#DEFEND
if Input.is_action_pressed("defend"):
if on_ground == true:
if attacking == false:
velocity.x = 0
defending = true
else:
defending = false
func _process(delta):
#MOVEMENT
if Input.is_action_pressed("ui_right"):
if attacking == false:
if crouched == false:
if defending == false:
$AnimatedSprite.play("Walk")
$AnimatedSprite.flip_h = false
elif Input.is_action_pressed("ui_left"):
if attacking == false:
if crouched == false:
if defending == false:
$AnimatedSprite.play("Walk")
$AnimatedSprite.flip_h = true
else:
if on_ground == true:
$AnimatedSprite.play("Idle")
#JUMP
if is_on_floor():
on_ground = true
else:
on_ground = false
if velocity.y < 0:
$AnimatedSprite.play("Jump")
else:
$AnimatedSprite.play("Fall")
#ATTACK
if Input.is_action_just_pressed("attack"):
if defending == false:
$AnimatedSprite.play("Light_Attack_1")
#CROUCH
if Input.is_action_pressed("ui_down"):
if on_ground == true:
if attacking == false:
$AnimatedSprite.play("Crouch")
#DEFEND
if Input.is_action_pressed("defend"):
if on_ground == true:
if attacking == false:
$AnimatedSprite.play("Defend")
Sorry, still new to this formatting thing.