Falling animation based on y velocity

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

I’m trying to build in that the jumping animation plays up until it starts falling again, but I can’t figure out a way to do it, and I didn’t see anything in the docs about it, does anyone know how to do it?

:bust_in_silhouette: Reply From: exuin

Try something like this:

if velocity.y < 0:
    sprite.play("jump")
else:
    sprite.play("fall")

This worked perfectly! Thanks so much!

SaphyrX173 | 2021-03-10 15:48