Bge Python: Move objects along one axis using mouse movement
Simple script, need more work but its good start.

from bge import logic
logic.mouse.visible = True
def main(cont): #cont = currentController
    cont.owner.worldPosition.x = logic.mouse.position[0]**2 # owner likely the cube


just add a cube and in logic nodes add always sensor + python controller.



EDIT

"logic.mouse.visible = True" show the mouse when bge its runnig so you can see the mouse position on screen.
For clarify: my script name is "script.py" so im using python controller to run a module name main from my script ("def main()"), so every tick it run main().

You can avoid this setin python controller to run script and not module:


and the script should be like this:

    from bge import logic
    logic.mouse.visible = True
    def main(cont): #cont = currentController
        cont.owner.worldPosition.x = logic.mouse.position[0]**2 # owner likely the cube
    main()


OR just this:

from bge import logic
cube = logic.getCurrentController().owner
cube.worldPosition.x = logic.mouse.position[0]**2


so this script NEED MORE WORK, to get it work like you want you need to work on it, and dont need to learn a bunch of things.

And for the last tip. mouse position go from 0.0 to 1.0 and when mouse position its > 0.5 will go to the left of the screen (your right) and the other way if its &lt; 0.5.
Finally if you show your work and not just and example without trying yourself to solve it, i cant help you anymore because the idea its to you learn something and not just copy.