How to make an input behave differently based upon player's movement and direction.

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

I’m trying to figure out how to change the way a double-jump behaves based upon if the player is rising or falling.

Do you know how I could implement this?

:bust_in_silhouette: Reply From: SpkingR

While the player jumps up, rising in the air, the velocity.y is less than 0(vector direction upward), then falling is on the opposite way: the velocity.y is greater than 0.
So my code will be:

if not is_on_floor() and velocity.y <= 0:
elif not is_on_floor() and velocity.y > 0:

Use KinematicBody2D as the player node.