Character motion moving script Im making a script for replace all my logic bricks used for moving, runing and jumping. 

I using "Character" Physics type for my player, and i using "Character motion" motion type:


Here is my script, i encounter some problems for making the motion correctly:

import bge
from bge import logic, events


def mouvements():

cont = bge.logic.getCurrentController()
own = cont.owner

keyboard = cont.sensors["Keyboard"]

VitesseMarche = 0.2 #Walking speed
VitesseCourrir = 0.5 #Runing speed

for key,status in keyboard.events:

    if status == logic.KX_INPUT_ACTIVE:

        # Avancer
        if key == events.UPARROWKEY:
            #Go forward
            print("Avancer")

        # Reculer
        if key == events.DOWNARROWKEY:
            #Go backward
            print("Reculer")

        # Gauche
        if key == events.LEFTARROWKEY:
            #Go left
            print("Gauche")

        # Droite
        if key == events.RIGHTARROWKEY:
            #Go right
            print("Droite")


    if status == logic.KX_INPUT_JUST_ACTIVATED:

        # Sauter
        if key == events.RIGHTCTRLKEY:
            #Jump
            print("Sauter")

mouvements()


The script need also Run and Diagonals functions (and mid-air moving if possible).

I have already tested some things, but there is always a problem.

-Or the movement still continue after the key no longer pressed.

-Or the moving are not local.

-Or the diagonals not working...

I have tried this:

own.orientation*Vector((0, 0.2, 0))


Found at: How to use KX_CharacterWrapper.walkDirection. But i may be bad. 

This script must be the lighter as possible.

I have a last thing, it is possible to make the inputs (UPARROW, DOWNARROW, LEFTARROW...) changeable, easyly, and in-game?

Thank you and have a nice day (I will include the name of the guy who help me in the credits of the script)!
[FR-EN] Advanced Moving Script for the BGE V2.0 by Hack0re.

Warning, this script only work with Character Physics Type. 

It does not work with Dynamic Physics Type.

The script include 95% of the instructions, in French and in English (142 Lines Header).

I will add more improvements in the near future...

Its my first real script, i just started in python, please be indulgent.

Features:

-Perfect for a FPS game.

-5 minutes needed to set in place (and even then).

-Moving in all directions, Diagonals and Running working perfectly.

-No pass through Walls or Sliding on ground.

-Walk speed and Running speed can be easyly edited in-game (Properties).

-Jump function with number of jumps can be changed in real time (You just unlocked the double jump).

/The jump hight not working for in-game, im sorry (if someone know how to do...).

-If the properties are not added, the script automatically use the default values.

-All the keyboard inputs can be "easyly" changed in-game , for making all the players happy .

-All the necessary instructions are include in the script (in French and English).

Downloads:

V2 (17/09/2015): https://mega.nz/#!m1cRlDIC!wrD1ovEznhxLGssZY26sndRUFv9amtsu_wVg_8VZ60Y

Please dont remove the Top Header.

Original link:
http://blenderartists.org/forum/showthread.php?381505-FR-EN-Advanced-Moving-Script-for-the-BGE-V2-0