My Releasing and Unreleasing animations are not working

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

var velocity = Vector2()
const SPEED = 30
const GRAVITY = 7
const FLOOR = Vector2(0, -1)
const JUMP_POWER = -150

var on_ground = false
var gun_activated = false

func _physics_process(delta):

if Input.is_action_pressed("release"):
	if gun_activated == false:
		gun_activated = true
		$AnimatedSprite.play("re")
elif Input.is_action_pressed("unrelease"):
	if gun_activated == true:
		gun_activated = false
	
if Input.is_action_pressed("ui_right"):
	velocity.x = SPEED
	$AnimatedSprite.play("Run")
	$AnimatedSprite.flip_h = false
elif Input.is_action_pressed("ui_left"):
	velocity.x = -SPEED
	$AnimatedSprite.play("Run")
	$AnimatedSprite.flip_h = true
else:
	velocity.x = 0
	if on_ground == true:
		$AnimatedSprite.play("idle")
		
if Input.is_action_pressed("ui_up") || Input.is_action_pressed("Jump"):
	if on_ground == true:
		velocity.y = JUMP_POWER
		on_ground = false
		
velocity.y += GRAVITY
	
if is_on_floor():
	on_ground = true
else:
	on_ground = false
	if velocity.y < 0:
		$AnimatedSprite.play("Jump")
	else:
		$AnimatedSprite.play("Fall")

velocity = move_and_slide(velocity, FLOOR)