How to create a Jump function for a topdown game?

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

Hello, I’m creating a topdown game and I want to use a Jump state, but idk how to do it in code. Atm I have this:

Simple right-left movement

mover = Vector2.ZERO
	if Input.is_action_pressed("direita"): #right
		mover.x += 1
	if Input.is_action_pressed("esquerda"): #left
		mover.x -= 1
	mover = mover.normalized() * speed
	if Input.is_action_just_pressed("pular"): #jump button

And my jump function:

mover.y = mover.y - 10

And my _physics_process:

mover = move_and_slide(mover)

I tried too using an AnimationPlayer, but cant set the position.y to the actual position in the game.
What I want its the player moving like 10-15 pixels up and then back to the original position.

:bust_in_silhouette: Reply From: Drbahadr

Create a timer and set its tim how much time you want your character on air.
Jump function:
#something like this#
mover.y = mover.y - 10

When timer times out:
mover.y = mover.y +10

Hope this can help