Movement with mouse

I’ve been trying to alter this script that rotates an object so that it moves the object, but i haven’t been too succesful :frowning: please help, (is there maybe a beter way for doing this?)

import GameLogic
import Rasterizer
sensitivity = .0005
directionLeft = -1
directionRight = -1
directionUp = 1
directionDown = 1
gameWidth = Rasterizer.getWindowWidth()
gameHeight = Rasterizer.getWindowHeight()
Rasterizer.setMousePosition(gameWidth/2, gameHeight/2)
controller = GameLogic.getCurrentController()
mouse = controller.getSensor(“Mouse”)
def mouseMove() :
x = mouse.getXPosition() - gameWidth/2
y = mouse.getYPosition() - gameHeight/2
return (x, y)
pos = mouseMove()
rotLeft = (pos[0] * directionLeft) * sensitivity
rotRight = (pos[0] * directionLeft) * sensitivity
rotUp = (pos[1] * directionLeft) * sensitivity
rotDown = (pos[1] * directionLeft) * sensitivity
Left = controller.getActuator(“LookLeft”)
Right = controller.getActuator(“LookRight”)
Up = controller.getActuator(“LookUp”)
Down = controller.getActuator(“LookDown”)
Left.setDRot( 0.0, 0.0, rotLeft, False)
Right.setDRot( 0.0, 0.0, rotRight, False)
Up.setDRot( 0.0, rotUp, 0.0, True)
Down.setDRot( 0.0, rotDown, 0.0, True)
GameLogic.addActiveActuator(Left, True)
GameLogic.addActiveActuator(Up, True)
GameLogic.addActiveActuator(Right, True)
GameLogic.addActiveActuator(Down, True)