I’m using blender 2.56 to make a small demo of my fps.
I followed a tutorial to make a mouse look script but when I test the script the command thing say: Input error, no module named bge.
This is the code I use:
###################################################
## Camera control script for blender 2.52.5 ##
## (or newer) ##
## ##
##Author: Paulo Bardes ##
## ##
##Description: This script controls the camera ##
## rotation using the mouse movement ##
## ##
##Usage: You need a mouse movement sensor called ##
## "Mouse" and 4 props: ##
## ##
## 1-"firstTime" = True ##
## 2-"x" = True/False (allow x rotation) ##
## 3-"y" = True/False (allow y rotation) ##
## 4-"sens" = any number bigger than 0 ##
## (controls the sesitivity of the rotation) ##
## ##
##Feel free to use copy modify etc... I hope you ##
##enjoy it and have a nice blending :^) ##
## ##
##Its a good idea to remove this header to make ##
##the script smaller and faster ;) ##
## ##
##BTW forgive any english mistake, it's not my ##
##first language... ##
###################################################
import bge
#bge.render.showMouse(True)#Uncomment to show the mouse
cont = bge.logic.getCurrentController()
obj = cont.owner
mouse = cont.sensors['Mouse']
#Function to calculate the mouse movement using the center of the screen as referene
def DeltaMouse(Xcenter,Ycenter,lockToCenter=False,Xpos=mouse.position[0],Ypos=mouse.position[1]):#this function calculates the ditance (in pixels) of the mouse from two given points
Dx = Xpos - Xcenter#Calculates the x variation
Dy = Ypos - Ycenter#the y variation
delta = [Dx,Dy]#Put in a list
if lockToCenter and Dx or Dy:#If the "lockToCenter" flag is true AND the mouse is NOT in the center
bge.render.setMousePosition(Xcenter,Ycenter)#It centers the mouse
return delta#Returns a list with the values
#The begining of the script
delta = DeltaMouse(int(bge.render.getWindowWidth()/2),int(bge.render.getWindowHeight()/2),True)#Gets the movement
if obj['firstTime']:#If it's the first time that the mouse moves the movement is ignored
delta = [0,0]#because the mouse wasan't in the center so it would generate a strange movement/gap
obj['firstTime'] = False#Sets the flag to False
Hrot = delta[0] * obj['sens'] / -1000#Generates a value to the Horizontal rotation (in degrees)
Vrot = delta[1] * obj['sens'] / -1000#Generates a value to the Vertical rotation (in degrees)
if obj['x']: obj.applyRotation([0,0,Hrot])#If the "x" prop is True it does the horizontal rotation (global z axis rotation)
if obj['y']: obj.applyRotation([Vrot,0,0],True)#If the "y" prop is True it does the vertical rotation (local x axis rotation)