What is going wrong here?

i have started seriously learning Blender Python.
But i cannot find out how to fix this problem >.>

all i want is that the cube follows the mouse position.
I attached the blend to show what i tired.

And there is another problem:
blender says all time that its unable to find GameLogic module…

pls help, greets Equal

Edit: after reading much more, i know now
that alt+p does not work for GameLogic,
only p in 3dview window works for it
the console showes the errors in same way.


RTS.blend (242 KB)

well…at first you should check your blender console every time something doesnt work. it gives you useful clues. use print statement too.
anyway there is no such thing as mouse.position
mouse coordinates are held in the sensor object.

import Blender
import GameLogic
import Rasterizer
print “---------------------------------------------------------”
cont = GameLogic.getCurrentController()

own = cont.getOwner()

mov = cont.getSensor(“MouseMove”)
xx = 0.0
yy = 0.0
if mov.isPositive():

xx = mov.getXPosition()/50.0
yy = mov.getYPosition()/50.0
print xx
thePos = [xx,yy,0.0]
own.localPosition = thePos

and u didnt need that actuator at all. what it does, it just moves the cube along the X axis every time mouse moves.
if you to move the obj in real 3D you need to apply some matrices and stuff. i cant explain u that, but search api or forums for that.
this currently moves the obj in top down view.