Objective: Allow the player to double jump.

We can modify our script a bit to allow for double jumping. Here’s the logic:

If we are grounded AND press the jump button,
apply the jump force and flag _canDoubleJump as true.

Else, if we press the jump button AND_canDoubleJump is true,
apply the jump force and flag _canDoubleJump as false.
(This way we can’t jump a third time.)

Else (if neither of the other two apply),
have gravity pull the player down.

That’s all there is to it!