8-way character animation

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

Hi, I am working on 8- way character animation.( I use AnimationPlayer)
I want it to be smooth - i.e. if last move was right and u move right again I want the animation to resume. I have read the docs and it says u can resume animation when u stop it with stop(false) but I dont really know how to stop it if it plays when u press a button(I tried stopping it with is_action_just_released but it plays the animation only once) . If there was a way to play an animation from specific I could use current_animation_position but I havent found one.

How can I handle it?


I tried

if Input.is_action_pressed("RIGHT"):
	input_direction.x += 1
	if last_animation == "right":
		animation_player.play()
	else:
		animation_player.play("right")
		last_animation = "right"
if Input.is_action_just_released("RIGHT"):
	animation_player.stop(false)