Set to false when kinematic body touches ground

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

So,i have a player(kinematicBody) is a sphere.
And i have an area,with his collision shape,mesh and also a static body(cuz i don’t want it to fall)

And i also have a script,if i press UP the player jumps,with a cooldown,

What i want is:
if the player press jump key cooldown is on,and it will reset to off when the player touches the ground after jumping.

Player Script:

    extends KinematicBody

    var velocidad = 100 #speed
    var gravedad = -9.8 #gravity
    var CDsalto = false #cooldown

   func _physics_process(delta):

var impulso = Vector3(0,0,0) #impulse
var dir = Vector3(0,0,0)#Direction

#Salto - jump
if (Input.is_action_pressed("ui_up") and CDsalto == false):
	impulso.y += 100
	CDsalto = true

#Gravedad - gravity
impulso.y += gravedad

#Aplicar Salto - apply jump
dir = impulso * velocidad
move_and_slide(dir * delta)

    #Suelo is ground in spanish
    func _on_Suelo_area_entered(area):
CDsalto = false

Screenshots:
Main Scene
Ground Scene
Player Scene

:bust_in_silhouette: Reply From: Player0330

Use This Code

extends KinematicBody
var velocidad = 100 #speed
var gravedad = -9.8 #gravity
func _physics_process(delta):
    var impulso = Vector3(0,0,0) #impulse
    var dir = Vector3(0,0,0)#Direction
    if is_on_floor():
        if (Input.is_action_pressed("ui_up")):
            impulso.y += 100
    impulso.y += gravedad
    dir = impulso * velocidad
    move_and_slide(dir * delta)