When you press the Spacebar, the character needs to jump like 1 high.
If you hold the Spacebar for 3 seconds the character needs to jump 3 high, after you release the Spacebar.
If you hold the Spacebar for like 2.5 seconds the character needs to jump 2.5 high, after you release the Spacebar.
And so on…
in theory you can cheat but reducing gravity while the space bar is down (and have player jump). Releasing space bar switches gravity back to original. Just a thought.