I have found lots of different mouse scripts searching the forums, but I have not come across one that allows me to just change a property…
If I can control the property’s of an actor I can control the IPO frames.
I have a cannon I need to change the elevation with the y movement, and a turret the gun is attached to to be assigned the X movement.
the game works great with keyboard but is a bit too complicated in my opinion.
I don’t have my blender stuff on me at the moment (damn you, viruses on windows!) but an approxamite version of the script (probably has bugs) is:
import GameLogic as g
import Rasterizer as r
cont=g.getCurrentController()
own=cont.getOwner()
mouse=cont.getSensor("mouse")
mouseX=mouse.getXPosition()
mouseY=mouse.getYPosition()
midX=r.getWindowWidth()/2
midY=r.getWindowHeight()/2
Xstep=.01
Ystep=.01
if 0<=own.X<=10:
own.X+=(midX-mouseX)*Xstep
if own.X<0:
own.X=0
if own.X>10:
own.X=10
if 0<=own.Y<=10:
own.Y+=(midY-mouseY)*Ystep
if own.Y<0:
own.Y=0
if own.Y>10:
own.Y=10
r.setMousePosition(midX,midY)
something like that, anyway. it needs to be plugged into a mouse movement sensor named mouse, and there need to be a float properties named X and Y.