I tell Godot to change the animation to user input but some of the animations won't play.

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

Hello!

I am working with the AnimationPlayer and I understand how it works. The issue I’m having is that when I write in my GDscript for the AnimationPlayer to change different animations based on user input and there are no issues that I can see with the code but for some weird reason only one of the test animations that I’m testing this plays while the rest not when I clearly stated all three of the test animations.

extends AnimationPlayer

 #the long list of controls XD
var UpRelease    = Input.is_action_just_released("ui_up")
var Up           = Input.is_action_pressed('ui_up')
var DownRelease  = Input.is_action_just_released('ui_down')
var Down         = Input.is_action_pressed('ui_down')
var RightRelease = Input.is_action_just_released('ui_right')
var Right        = Input.is_action_pressed('ui_right')
var LeftRelease  = Input.is_action_just_released('ui_left')
var Left         = Input.is_action_pressed('ui_left')

func _ready():
	#getting the animation data
	get_animation("standingRight")
	get_animation("standingLeft")
	get_animation("standingFoward")
	set_process(true)
	
func _process(delta):
	UpRelease    = Input.is_action_just_released("ui_up")
	Up           = Input.is_action_pressed('ui_up')
	DownRelease  = Input.is_action_just_released('ui_down')
	Down         = Input.is_action_pressed('ui_down')
	RightRelease = Input.is_action_just_released('ui_right')
	Right        = Input.is_action_pressed('ui_right')
	LeftRelease  = Input.is_action_just_released('ui_left')
	Left         = Input.is_action_pressed('ui_left')
    # this is where I put the playing commands
	if DownRelease == true:
		play('standingFoward')
	if RightRelease == true:
		play('standingRight')
	if LeftRelease == true:
		play("standingLeft")

Doesn’t answer your question, but I don’t think the get_animation() calls are doing anything since you aren’t assigning them to variables or anything.

Socrates | 2018-05-11 02:40

:bust_in_silhouette: Reply From: Robster

I may not be correct but if you have a play() in the process delta isn’t it trying to play it every single frame? So it keeps starting the animation again each frame, which makes it look like it’s not playing?

Oh okay thanks
I’ll try that

Noob_Maker | 2018-05-11 22:28

No it just made it that none of the animations to play so it’s not that it’s because it’s in process(delta) it has to be something else

Noob_Maker | 2018-05-12 00:11

Did you find it?

Robster | 2018-05-14 05:59

nope
I didn’t ;-;

Noob_Maker | 2018-05-18 19:29