Hopefully this should work:
extends KinematicBody2D
const ACCELERATION = 0
const MAX_SPEED = 64
const FRICTION = 0
const AIR_RESISTANCE = 0
const GRAVITY = 1500
const JUMP_FORCE = 750
var double_jump = false
var motion = Vector2.ZERO
func _physics_process(delta):
if motion.y > 0:
motion.y += GRAVITY * delta * 2
else:
motion.y += GRAVITY * delta
if is_on_floor():
double_jump = false
if Input.is_action_just_pressed("Jump"):
motion.y = -JUMP_FORCE
else:
if Input.is_action_just_pressed("Jump"):
if double_jump == false:
motion.y = -JUMP_FORCE
double_jump = true
if Input.is_action_just_released("Jump") and motion.y < -JUMP_FORCE/2:
motion.y = -JUMP_FORCE/2
motion = move_and_slide(motion, Vector2.UP)