| Methods: |
| getCamera |
setCamera |
| getScene |
setScene |
| getUseRestart |
setUseRestart
|
|
Inherited
Methods: |
| getExecutePriority |
isA |
| getOwner |
setExecutePriority |
| getName |
---------- |
|
|
getCamera
getCamera()
Returns the name of camera the actuator is set to switch to.
Type: string
Sample
Code
# get controller
controller = GameLogic.getCurrentController()
# get actuator named switchCam
act = controller.getActuator("switchCam")
# get camera name
name = act.getCamera()
getScene
getScene()
Returns the name of the scene you want to: switch to / overlay /
underlay / remove / suspend / resume.
Returns an empty string if a scene hasn't been set.
Type: string
Sample
Code
# get controller
controller = GameLogic.getCurrentController()
# get actuator named switchScene
act = controller.getActuator("switchScene")
# get scene name
name = act.getScene()
getUseRestart
getUseRestart()
Returns if the scene will be restarted.
Type: Bool
1 = True = want scene to be restarted
0 = False = don't want scene to be restarted
Sample
Code
# get controller
controller = GameLogic.getCurrentController()
# get actuator named restartScene
act = controller.getActuator("restartScene")
# will scene be restarted?
restart = act.getUseRestart()
setCamera
setCamera(camera)
Set the camera to switch to.
camera:
Type:
KX_Camera or string
Sample
Code
# get controller
controller = GameLogic.getCurrentController()
# get actuator named switchCam
act = controller.getActuator("switchCam")
# set camera name
act.setCamera("OBCam_1")
# Switch to new camera
GameLogic.addActiveActuator( act, True)
setScene
setScene(scene)
Sets the name of the scene you want to: switch to / overlay / underlay
/ remove / suspend / resume.
scene:
Type:
string
Sample
Code
# get controller
controller = GameLogic.getCurrentController()
# get actuator named switchScene
act = controller.getActuator("switchScene")
# set scene name to Level2
act.setScene("Level2")
# Switch to new scene
GameLogic.addActiveActuator( act, True)
setUseRestart
setUseRestart(flag)
Set flag to True to restart the scene
flag:
Type: Bool
1 or True = restart scene
0 or False = don't restart scene
Note:
Doesn't work
Sample
Code
# get controller
controller = GameLogic.getCurrentController()
# get actuator named restartScene
act = controller.getActuator("restartScene")
# set flag to True
act.setUseRestart(True)
getExecutePriority
getExecutePriority()
Gets the execute priority of the logic brick
Return Type: integer
Doesn't
work:
Crashes Blender
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the actuator named act
act = controller.getActuator("act")
# get brick priority
priority = act.getExecutePriority()
getOwner
getOwner()
Gets the game object that owns the logic brick.
Return Type: KX_GameObject
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the actuator named act
act = controller.getActuator("act")
# get brick owner
owner = act.getOwner()
setExecutePriority
setExecutePriority(priority)
Sets the execution priority of the logic brick.
priority:
Type: integer
0 is first
1 is second
etc.
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the actuator named act
act = controller.getActuator("act")
# set brick priority to be first
act.setExecutePriority(0)
isA
isA(Type)
Checks the Object type.
(KX_GameObject,
SCA_ILogicBrick, KX_Scene, etc.)
Type: String
Return Type: Bool
1 = True
0 = False
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the object controller attached to
owner = controller.getOwner()
# is owner a GameObject?
gameObject = owner.isA("KX_GameObject")
getName
getName()
Returns the name of actuator
Return Type: string
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get a list of the attached actuators
actList = controller.getActuators()
# loop through the list of actuators
for act in actList:
# look for an
actuator named "RocketMotion"
if act.getName() ==
"RocketMotion":
# use it
GameLogic.addActiveActuator(act,
True)
# Done.
Break out of loop
break
|