diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-10-31 22:31:45 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-10-31 22:31:45 +0300 |
commit | f9b19d54b5a07c5d654ecb634aefc5690e07e6fd (patch) | |
tree | 746a80208ae1b0a3b98c678af45d37fe26c28325 /release/scripts/templates/gamelogic.py | |
parent | af72bb50ae41f5ba1f9f5b2310b2aee77907fecf (diff) |
tabs to spaces, remove trailing white space. (apart of pep8)
didnt do "release/scripts/io" since some exporters cant be auto converted
Diffstat (limited to 'release/scripts/templates/gamelogic.py')
-rw-r--r-- | release/scripts/templates/gamelogic.py | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/release/scripts/templates/gamelogic.py b/release/scripts/templates/gamelogic.py index af9dbd8a56a..8bfe799bacf 100644 --- a/release/scripts/templates/gamelogic.py +++ b/release/scripts/templates/gamelogic.py @@ -4,75 +4,75 @@ # GameLogic has been added to the global namespace no need to import # for keyboard event comparison -# import GameKeys +# import GameKeys # support for Vector(), Matrix() types and advanced functions like AngleBetweenVecs(v1,v2) and RotationMatrix(...) -# import Mathutils +# import Mathutils # for functions like getWindowWidth(), getWindowHeight() # import Rasterizer def main(): - cont = GameLogic.getCurrentController() - - # The KX_GameObject that owns this controller. - own = cont.owner - - # for scripts that deal with spacial logic - own_pos = own.worldPosition - - - # Some example functions, remove to write your own script. - # check for a positive sensor, will run on any object without errors. - print 'Logic info for KX_GameObject', own.name - input = False - - for sens in cont.sensors: - # The sensor can be on another object, we may want to use it - own_sens = sens.owner - print ' sensor:', sens.name, - if sens.positive: - print '(true)' - input = True - else: - print '(false)' - - for actu in cont.actuators: - # The actuator can be on another object, we may want to use it - own_actu = actu.owner - print ' actuator:', actu.name - - # This runs the actuator or turns it off - # note that actuators will continue to run unless explicitly turned off. - if input: - cont.activate(actu) - else: - cont.deactivate(actu) - - # Its also good practice to get sensors and actuators by name - # rather then index so any changes to their order wont break the script. - - # sens_key = cont.sensors['key_sensor'] - # actu_motion = cont.actuators['motion'] - - - # Loop through all other objects in the scene - sce = GameLogic.getCurrentScene() - print 'Scene Objects:', sce.name - for ob in sce.objects: - print ' ', ob.name, ob.worldPosition - - - # Example where collision objects are checked for their properties - # adding to our objects "life" property - """ - actu_collide = cont.sensors['collision_sens'] - for ob in actu_collide.objectHitList: - # Check to see the object has this property - if ob.has_key('life'): - own['life'] += ob['life'] - ob['life'] = 0 - print own['life'] - """ + cont = GameLogic.getCurrentController() + + # The KX_GameObject that owns this controller. + own = cont.owner + + # for scripts that deal with spacial logic + own_pos = own.worldPosition + + + # Some example functions, remove to write your own script. + # check for a positive sensor, will run on any object without errors. + print 'Logic info for KX_GameObject', own.name + input = False + + for sens in cont.sensors: + # The sensor can be on another object, we may want to use it + own_sens = sens.owner + print ' sensor:', sens.name, + if sens.positive: + print '(true)' + input = True + else: + print '(false)' + + for actu in cont.actuators: + # The actuator can be on another object, we may want to use it + own_actu = actu.owner + print ' actuator:', actu.name + + # This runs the actuator or turns it off + # note that actuators will continue to run unless explicitly turned off. + if input: + cont.activate(actu) + else: + cont.deactivate(actu) + + # Its also good practice to get sensors and actuators by name + # rather then index so any changes to their order wont break the script. + + # sens_key = cont.sensors['key_sensor'] + # actu_motion = cont.actuators['motion'] + + + # Loop through all other objects in the scene + sce = GameLogic.getCurrentScene() + print 'Scene Objects:', sce.name + for ob in sce.objects: + print ' ', ob.name, ob.worldPosition + + + # Example where collision objects are checked for their properties + # adding to our objects "life" property + """ + actu_collide = cont.sensors['collision_sens'] + for ob in actu_collide.objectHitList: + # Check to see the object has this property + if ob.has_key('life'): + own['life'] += ob['life'] + ob['life'] = 0 + print own['life'] + """ main() |