how to air displacement 2D?

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

hi, i’m traying to make a movement in the air while my player is jumping, but a have some problems; when the player it’s in the point 0 of Y qhuen it jump i stop the movement in Y so i can make a displacement in X while i’m pressing “ui_right” or “ui_left”, i got this:

if (!is_on_floor() && movimiento_cebollin.y > 0 && Input.is_action_pressed("ui_right")):
	self.position.x += 100
	var air_displacement = true
	movimiento_cebollin.y = 0;

	if (air_displacement):
		print("here it's has to fall")
		movimiento_cebollin.y -= cebollin_jump_speed; 

when 100 is added to self.position.x i want that the player inmediatly stop and fall, but it’s keep falling in a vertical way, and also the movement look’s like a teleport lol

I think if you apply delta to movement, it will be smooth and… you have reset to 0 the Y movement when is greater tan 0… I don’t understand why, that make you go down immediately.
If I’m on a mistake, please, somebody correct me.

SerK | 2020-07-06 15:17