2009-10-29 11:26:44 +00:00
|
|
|
# This module can be accessed by a python controller with
|
|
|
|
# its execution method set to 'Module'
|
|
|
|
# * Set the module string to "gamelogic_module.main" (without quotes)
|
|
|
|
# * When renaming the script it MUST have a .py extension
|
|
|
|
# * External text modules are supported as long as they are at
|
|
|
|
# the same location as the blendfile or one of its libraries.
|
|
|
|
|
2010-10-11 22:25:28 +00:00
|
|
|
import bge
|
2009-10-29 11:26:44 +00:00
|
|
|
|
|
|
|
# variables defined here will only be set once when the
|
2011-10-17 06:58:07 +00:00
|
|
|
# module is first imported. Set object specific vars
|
2009-10-29 11:26:44 +00:00
|
|
|
# inside the function if you intend to use the module
|
|
|
|
# with multiple objects.
|
|
|
|
|
2011-01-26 07:54:27 +00:00
|
|
|
|
2009-10-29 11:26:44 +00:00
|
|
|
def main(cont):
|
2009-10-31 19:31:45 +00:00
|
|
|
own = cont.owner
|
|
|
|
|
|
|
|
sens = cont.sensors['mySensor']
|
|
|
|
actu = cont.actuators['myActuator']
|
|
|
|
|
|
|
|
if sens.positive:
|
|
|
|
cont.activate(actu)
|
|
|
|
else:
|
|
|
|
cont.deactivate(actu)
|
2009-10-29 11:26:44 +00:00
|
|
|
|
2010-10-11 22:25:28 +00:00
|
|
|
# dont call main(bge.logic.getCurrentController()), the py controller will
|