speed variation in BGE
add a keyboard sensor and connect it to a python controller 

    own = cont.owner
    key_w = own.sensors['w']# can assign any key make sure the sensor is the same

        max_speed = 2
        if key_w.positive:
            if speed_var &lt; max_speed:
              speed_var += 0.25#how quickly to accelerate  
        else:
        speed_var = 0#you can also do the same here by subtracting 0.25
# until 0 is reached...make sure you do a check that it stays above 0