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:


