The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

My run and idle animations always work, but despite having it set to play other animations on inputs they only ever play the first frame. This is whats working for my run and idle:

if x_input != 0:
    $AnimationPlayer.play("Run")
    motion.x += x_input * ACCELERATION * delta
    motion.x = clamp(motion.x, -MAX_SPEED, MAX_SPEED)
    sprite.flip_h = x_input < 0

else:
    $AnimationPlayer.play("Idle")`

This is what's only giving me one frame:

    if Input.is_action_pressed("ui_special"):
        $AnimationPlayer.play("Float")
        motion.y = JUMP_FORCE*AIR_RESISTANCE*4

What do I need to do to make it play the whole thing out? I also have moveandslide on, I don't know if that's got something to do with it.

Godot version 3.2.2
in Engine by (19 points)
edited by

2 Answers

0 votes

I think the problem here is the you dont call the function play() just one time. When you press the button "ui_special" it does call th func play in every frame so it plays only the first frame. I suggest you to use Input.is_action_just_pressed("ui_special"). I think that will help.

by (16 points)

I tried that, but now both the animation and the effect only last for 1 frame before stopping

0 votes

What do I need to do to make it play the whole thing out? I also have ( میز و صندلی کودک ) moveandslide on, I don't know if that's got something to do with it.

by (14 points)

Yeah, I want it to play it out on loop the same way it does Idle and Run

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 Frequently asked questions and 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 [email protected] with your username.