problems with animations based on rotation

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

ok, i’m trying to make animations play on an animated sprite based on the rotation, however no animations play at all, can someone help me?

func _process(delta):
	rotation_degrees = int(rotation_degrees)%360
	if vel.x == 0 and vel.y == 0 and directiony<0 and directionx<0 :#and gun.rotation_degrees <= 180 and gun.rotation_degrees > 120 :
		anim.play("idleUL")
	if vel.x == 0 and vel.y == 0 and directiony<0 and directionx>0 :#and gun.rotation_degrees > 0 and gun.rotation_degrees < 60 :
		anim.play("idleUR")
	if vel.x == 0 and vel.y == 0 and directiony>0 and directionx>0 :# gun.rotation_degrees <= 360 and gun.rotation_degrees > 300 :
		anim.play("idleDR")
	if vel.x == 0 and vel.y == 0 and directiony>0 and directionx<0 :#and gun.rotation_degrees < 240 and gun.rotation_degrees > 180 :
		anim.play("idleDL")
	elif vel.x == 0 and vel.y == 0 and directionx==0 and directiony==0 :#and gun.rotation_degrees <= 120 and gun.rotation_degrees >= 60 :
		anim.play("idleU")
	elif vel.x == 0 and vel.y == 0 and directionx==0 and directiony==0 :#and gun.rotation_degrees <= 300 and gun.rotation_degrees >= 240 :
		anim.play("idleD")

i’ve already tried to make the animations play based on a input to check if i was using the right function and it did work, so i guess the problem is happening when i try to make it based on rotation