Did you try to apply the player_gravity() to the player without any other function? That's the function that should determine the hieght of the player above the ground.