There is a variety of things going wrong here. I think you would find learning about Finite State Machines (FSMs) to be very valuable for this kind of state changing for characters.
As @rustyStriker says, you don't want to do all the iterations in one frame. That's instant. You want to apply a velocity frame by frame, and here you would need some logic to make use of your "jumped" state. if (jumped): apply forces here
The forces should be made to decay so the player eventually is overcome by the gravity vector and hits the floor. Then this state turns the jump flag off so you can read the keys again for another jump.
Then I wonder about your line that says hVector = hVector * (delta * hSpeed)
Your hSpeed is set to 0. So everything multiplied by 0 is zero, so you're always going to get a 0, 0 hVector.
Lastly, the animation should be put into the state checking. Because what happens here is that jump fully resolves in one frame, and so you might get to see the jump animation for 1/60th of second? Until the next frame, at which point it passes over the input/jump branch, and plays the other animation.
This means too that you should be checking the state of the animation, as you don't want to keep restarting it from 0 by constantly calling play()
. There is an get_current_animation()
method you can consult, and various others depending on how you wish to structure your logic.
That is the general gist of it. More complete information on the animation methods can be found in the docs: http://docs.godotengine.org/en/stable/classes/class_animationplayer.html#class-animationplayer-get-current-animation