smoother gravity

Godot Version

Godot 4.2.2v

Question

so i am trying to make the enemy or the entity (2D btw) that when he walks off an edge instead of the entity falling in a constant speed, i want to make it so that the entity's falling speed increases like real life (sorry for bad explanation, i am still new in english :D and thank you for ur time)

extends CharacterBody2D

const GRAVITY = 10

func _physics_process(delta):
	velocity.y += GRAVITY * delta
	if is_on_floor():
		velocity.y = GRAVITY
	
	move_and_slide()

So you want to say that how you can increase gravity while falling?

Try this:

var gravity_increase_speed = 50

if !is_on_floor():
   gravity += delta * gravity_increase_speed
   gravity = clampf(gravity, 0.0, 100.0)
else:
   gravity = 9.8

velocity.y += gravity * delta