This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

So I'm trying to make my character have a falling animation that plays if the player doesn't press the jump button but still goes off a ledge. I'm still pretty new to this so I don't know if I have to rearrange my whole animation code or just add something.

func _process(delta):
if on_floor == false:
    if Input.is_action_pressed("Jump"):
        $AnimatedSprite.play("Jumping") 
elif is_on_floor():
    if Input.is_action_pressed("ui_right"):
        $AnimatedSprite.play("Running")
    elif Input.is_action_pressed("ui_left"):
        $AnimatedSprite.play("Running")
    elif Input.is_action_pressed("Jump"):
        $AnimatedSprite.play("Idle")
    else:
        $AnimatedSprite.play("Idle")
Godot version 3.0
in Engine by (17 points)

2 Answers

0 votes

You can add a "jumped" variable, set to true on jump, false on landing. Then, if you are off the ground, didn't jump and haven't started the falling animation, start it.

by (2,720 points)
0 votes

Maybe just make it check if the velocity is positive (aka the player is going down)

by (16 points)
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.