Attention | Topic was automatically imported from the old Question2Answer platform. | |
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.