going up animation not working

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

my going up animation is not working and I have no idea about it
this is the code for the node the node that not play the going up animation:

extends KinematicBody2D

var speed : int = 400
var vol : Vector2 = Vector2()
onready var player = get_node(".")
onready var sprite = get_node("animations")

func _physics_process(delta):
vol.x = 0
vol.y = 0
if Input.is_action_pressed("go_right"):
	vol.x += speed
if Input.is_action_pressed("go_left"):
	vol.x -= speed
if Input.is_action_pressed("go_up"):
	vol.y -= speed
if Input.is_action_pressed("go_down"):
	vol.y += speed
vol = move_and_slide(vol, Vector2.UP)

if vol.x == 0:
	sprite.play("idle")
elif vol.x < 0:
	sprite.set_flip_h(true)
	sprite.play("walking")
elif vol.x > 0:
	sprite.set_flip_h(false)
	sprite.play("walking")
elif vol.y < 0:
	sprite.set_flip_h(false)
	sprite.play("walking")
elif vol.y > 0:
	sprite.set_flip_h(false)
	sprite.play("walking")

but my going left and right ones are working, only my going up and down is not working is not working

and you please solve this problem.

:bust_in_silhouette: Reply From: Inces

You are using one animation for all those directions, the only difference is sprite flip. This means that whatever You press, whatever the direction, one and the same animation is playing.
What do You want to happen when pressing up ? How does Your “walking” animation look ? You know that You are only flipping sprite horizontally and not vertically, right ? If You want to flip it vertically use flip_v