How do you implement a jump mechanic like this?

Godot Version

4.2.2

Question

For people who know these games, I will say that I need help with the implementation of a jump like in “Undertale”. For the rest of you, I’ll explain that I need to redo the standard jump mechanics so that the character rises while the jump button is pressed. At the same time, letting go of it, it will almost immediately begin to fall, succumbing to only a slight inertia. And from that moment on, he will not be able to jump again until he touches a hard surface. How to do this? Is this even feasible in this engine?

like it?
jump_state{
floor,
jumping,
fall
}
if (jump_state == floor && user press jump action) jump_state = jumping
if (jump_state == jumping && !user pressing jump action) jump_state = fall
if (jump_state == fall && isOnFloor) jump_state = floor

when jumping:
Yspeed = ?
when fall
Yspeed = ?
when floor
Yspeed = 0

I cant understand this…