0 votes

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")
in Engine by (83 points)

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.

1 Answer

0 votes

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?

by (810 points)

Oh okay thanks
I'll try that

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

Did you find it?

nope
I didn't ;-;

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.

Categories