Welcome to mirror list, hosted at ThFree Co, Russian Federation.

GameLogic.py « PyDoc « gameengine « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 08f71e50f97bc7be57d0886106d494a453843f76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# $Id$
"""
Documentation for the GameLogic Module.
=======================================

	There are only three importable modules in the game engine:
		- GameLogic
		- L{GameKeys}
		- L{Rasterizer}
	
	All the other modules are accessibly through the methods in GameLogic.
	
	Examples::
		# To get a controller:
		import GameLogic
		co = GameLogic.getCurrentController()
		
		# To get the game object associated with this controller:
		obj = co.getOwner()
	L{KX_GameObject} and possibly L{KX_Camera} and L{KX_Light} methods are
	available depending on the type of object::
		# To get a sensor linked to this controller.
		# "sensorname" is the name of the sensor as defined in the Blender interface.
		sens = co.getSensor("sensorname")
	L{KX_NetworkMessageSensor}, L{KX_RaySensor}, L{KX_TouchSensor}, L{SCA_KeyboardSensor}, 
	L{SCA_MouseSensor}, L{SCA_PropertySensor} and L{SCA_RandomSensor} methods are available, 
	depending on the type of sensor::
		# To get a list of all sensors:
		sensors = co.B{getSensors}()



Constants
=========
	- KX_TRUE:  True value used by some modules
	- KX_FALSE: False value used by some modules.

Property Sensor
---------------
	Tests that the property sensor is able to perform. See L{SCA_PropertySensor}
		- KX_PROPSENSOR_EQUAL:		Activate when the property is equal to the sensor value.
		- KX_PROPSENSOR_NOTEQUAL:	Activate when the property is not equal to the sensor value.
		- KX_PROPSENSOR_INTERVAL:	Activate when the property is between the specified limits.
		- KX_PROPSENSOR_CHANGED:	Activate when the property changes
		- KX_PROPSENSOR_EXPRESSION:	Activate when the expression matches

Constraint Actuator
-------------------
	The axis and type (location/rotation) of constraint. See L{KX_ConstraintActuator}
		- KX_CONSTRAINTACT_LOCX
		- KX_CONSTRAINTACT_LOCY
		- KX_CONSTRAINTACT_LOCZ
		- KX_CONSTRAINTACT_ROTX
		- KX_CONSTRAINTACT_ROTY
		- KX_CONSTRAINTACT_ROTZ

IPO Actuator
------------
	IPO Types.  See L{KX_IpoActuator}
		- KX_IPOACT_PLAY
		- KX_IPOACT_PINGPONG
		- KX_IPOACT_FLIPPER
		- KX_IPOACT_LOOPSTOP
		- KX_IPOACT_LOOPEND

Random Distributions
--------------------
	See L{SCA_RandomActuator}
		- KX_RANDOMACT_BOOL_CONST
		- KX_RANDOMACT_BOOL_UNIFORM
		- KX_RANDOMACT_BOOL_BERNOUILLI
		- KX_RANDOMACT_INT_CONST
		- KX_RANDOMACT_INT_UNIFORM
		- KX_RANDOMACT_INT_POISSON
		- KX_RANDOMACT_FLOAT_CONST
		- KX_RANDOMACT_FLOAT_UNIFORM
		- KX_RANDOMACT_FLOAT_NORMAL
		- KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL

"""


def getCurrentController():
	"""
	Gets the Python controller associated with this Python script.
	
	@rtype: L{SCA_PythonController}
	"""
def getCurrentScene():
	"""
	Gets the current Scene.
	
	@rtype: L{KX_Scene}
	"""
def addActiveActuator(actuator, activate):
	"""
	Activates the given actuator.
	
	@type actuator: L{SCA_IActuator}
	@type activate: boolean
	@param activate: whether to activate or deactivate the given actuator.
	"""
def getRandomFloat():
	"""
	Returns a random floating point value in the range [0...1)
	"""
def setGravity(gravity):
	"""
	Sets the world gravity.
	
	@type gravity: list [fx, fy, fz]
	"""
def getSpectrum():
	"""
	Returns a 512 point list from the sound card.
	This only works if the fmod sound driver is being used.
	
	@rtype: list [float], len(getSpectrum()) == 512
	"""
def stopDSP():
	"""
	Stops the sound driver using DSP effects.
	
	Only the fmod sound driver supports this.
	DSP can be computationally expensive.
	"""