How can I retain velocity during a jump?

I am using Goran’s 2.6x FPS base frame in my project and I could use a little help adding some features. It currently supports WASD movement and jumping with space. The feature I want to add is retaining velocity while jumping, i.e. running jumps that propel you forward. As it is, you can only jump while standing still and you will only go straight up. Any ideas would be appreciated. The other feature I want to add is to enable a flight mode, i.e. q makes you ascend and e makes you descend. I though about simply turning off gravity, but that seems to disable movement altogether. Again, any ideas would be appreciated. Here is the code;

"""Goran's 2.6x FPS base-frame


2011 - Goran Milovanvic - nilunder.com


"""


from bge import render, logic
from mathutils import Vector


class MouseLook:
    
    def __init__(self, cont, body):
        
        self.cont = cont
        self.camera = cont.owner
        self.body = body
        
        self.sen_mouse = self.cont.sensors["mouse"]
        
        x = render.getWindowWidth()//2
        y = render.getWindowHeight()//2
        self.screen_center = (x, y)
        
        render.setMousePosition(x + 1, y + 1)
        
        self.offset_accum = Vector((0, 0))
        
        self.main = self._blankRun
        
        
    def _getMouseOffset(self):
        
        vec_scrc = Vector(self.screen_center)
        vec_mpos = Vector(self.sen_mouse.position)
        
        return vec_mpos - vec_scrc
    
    
    def _blankRun(self): # allow self.sen_mouse.position to update
        
        self.main = self._mainAction
        
        
    def _mainAction(self):
        
        mouse_offset = self._getMouseOffset()
        self.offset_accum += (mouse_offset - self.offset_accum) * 0.2
        
        rot = self.offset_accum * -0.002
        
        self.camera.applyRotation([rot.y, 0, 0], 1)
        self.body.applyRotation([0, 0, rot.x], 1)
        
        render.setMousePosition(*self.screen_center)






class MoveWSAD:
    
    def __init__(self, cont_camera, own_body):
        
        self.cont = cont_camera
        self.body = own_body
        
        # Required sensors:
        self.sen_key_w = self.cont.sensors["W"]
        self.sen_key_s = self.cont.sensors["S"]
        self.sen_key_a = self.cont.sensors["A"]
        self.sen_key_d = self.cont.sensors["D"]


        self.sen_key_space = self.cont.sensors["space"]
        self.sen_col_onground = self.cont.sensors["onground"]
        
        # Attributes
        self.speed_ground = 100
        self.speed_jump = self.speed_ground / .5


        self.main = self._inAir




    def _getMoveVec(self):


        forward_back = self.sen_key_w.positive - self.sen_key_s.positive
        left_right = self.sen_key_d.positive - self.sen_key_a.positive
        
        velocity = Vector((left_right, forward_back, 0))
        
        return velocity
    
        
    def _onGround(self):


        vec_velocity = self._getMoveVec()


        vec_velocity.magnitude = self.speed_ground


        if self.sen_key_space.positive:
            vec_velocity.z = self.speed_jump


        self.body.setLinearVelocity(vec_velocity, 1)


        if not self.sen_col_onground.positive:
            self.main = self._inAir
    
    def _inAir(self):


        if self.sen_col_onground.positive:
            self.main = self._onGround

it also calls this;

from bge import logicimport fps


class Player:
    
    def __init__(self, cont, body):
        
        self.mouse_look = fps.MouseLook(cont, body)
        self.move_wsad = fps.MoveWSAD(cont, body)
        
    def main(self):
        
        self.mouse_look.main()
        self.move_wsad.main()
 
 
player = Player(logic.getCurrentController(),\
                logic.getCurrentScene().objects["00Player"])       


def main():
    
    player.main()

Please have a look and let me know what you think. Ideas, suggestions, or solutions would be appreciated.

It turns out this method already does retain velocity, but I had the setting so high it wasn’t discernible. Anyway this is solved.