Use arrow keys or WASD keys to move. Just shared for testing.
I made it so it works, the in air variable now goes to 2, and so that when the touching ground block fires right afterwards, the variable is still above 0. I also recommend doing something about that Yv variable going insanely negative. Eventually it might break something.