Game Creation Kit: Last modified 02/02/07 17:04:05 cw
Prev | Chapter 28. Python | Next

# 28.3. Game Python Documentation per module

## 28.3.1. GameLogic Module

``SCA_PythonController getCurrentController`( );`

Returns the Controller object that carries the script.

``void addActiveActuator`( actuator , bool active );`

This method makes the Actuator "actuator" active ("active=TRUE") or inactive ("active=FALSE").

``float getRandomFloat`( );`

This function returns a random float in the range of 0.0...1.0. The seed is taken from the system time, so you get a different sequence of random numbers at every game start.

``setGravity`( [gravityX,gravityY,gravityZ] );`

Sets the world gravity.

## 28.3.2. Rasterizer Module

``int getWindowWidth`( );`

This function returns the width of the Blender window the game is running in.

``int getWindowHeight`( );`

This function returns the height of the Blender window the game is running in.

``void makeScreenshot`( char* filename );`

This function writes a screenshot of the game as a TGA file to disk.

``enableVisibility`( bool usevisibility );`

This sets all objects to invisible when "usevisibility" is TRUE. The game can then set the visibility back to "on" for the necessary objects only.

``showMouse`( bool show );`

Shows or hides the mouse cursor while the game engine runs, depending on the show parameter. The default behaviour is to hide the mouse, but moving over the window border will reveal it again, so set the mouse cursor visibility explicitly with this function.

``setBackgroundColor`( list [float R,float G,float B] );`

Sets the Backgroundcolor. Same as the horizon color in the WorldButtons.

``setMistColor`( list [float R,float G,float B] );`

Sets the mist (fog) color. In the game engine you can set the mist color independantly from the backgroundcolor. To have a mist effect, activate "Mist" in the WorldButtons.

``setMistStart`( float start );`

Sets the distance where the Mist starts to have effect. See also the WorldButtons.

``setMistEnd`( float end );`

Sets the distance from MistStart (0% Mist) to 100% mist. See also the WorldButtons.

## 28.3.3. GameKeys Module

This is a module that simply defines all keyboard keynames (AKEY = 65 etc).

"AKEY", ..., "ZKEY", "ZERO_KEY" , ..., "NINEKEY", "CAPSLOCKKEY", "LEFTCTRLKEY", "LEFTALTKEY", "RIGHTALTKEY", "RIGHTCTRLKEY", "RIGHTSHIFTKEY", "LEFTSHIFTKEY", "ESCKEY", "TABKEY", "RETKEY", "SPACEKEY", "LINEFEEDKEY", "BACKSPACEKEY", "DELKEY", "SEMICOLONKEY", "PERIODKEY", "COMMAKEY", "QUOTEKEY", "ACCENTGRAVEKEY", "MINUSKEY", "VIRGULEKEY", "SLASHKEY", "BACKSLASHKEY", "EQUALKEY", "LEFTBRACKETKEY", "RIGHTBRACKETKEY", "LEFTARROWKEY", "DOWNARROWKEY", "RIGHTARROWKEY", "UPARROWKEY", "PAD0", ..., "PAD9", "PADPERIOD", "PADVIRGULEKEY", "PADASTERKEY", "PADMINUS", "PADENTER", "PADPLUSKEY", "F1KEY", ..., "F12KEY", "PAUSEKEY", "INSERTKEY", "HOMEKEY", "PAGEUPKEY", "PAGEDOWNKEY", and "ENDKEY".

Prev | Home | Next
Python for games | Up | Standard methods for LogicBricks