I'm starting to add coyote jumps and jump buffering to my player code and Invalid operands happen
func _physics_process(delta) -> void:
was_on_the_floor = is_on_floor()
# Handle gravity.
if not is_on_floor():
velocity.y += get_gravity() * delta # Gravity is added to the y velocity.
velocity.y = -1
if was_on_the_floor and velocity.y >= 0:
can_coyote_jump = true
get_tree().create_timer(coyote_time).timeout.connect(func(): can_coyote_jump = false)
else:
if jump_pressed:
velocity.y = JUMP_VELOCITY # Apply jump velocity
jump_pressed = false
jump_buffer_timer.stop() # Stop the jump buffer timer