From 0143a8c6e546eeb63bbe90750fa6b628837e9903 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 11 Oct 2010 22:25:28 +0000 Subject: update for gamelogic templates --- release/scripts/templates/gamelogic.py | 9 +++------ release/scripts/templates/gamelogic_basic.py | 3 ++- release/scripts/templates/gamelogic_module.py | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) (limited to 'release/scripts/templates') diff --git a/release/scripts/templates/gamelogic.py b/release/scripts/templates/gamelogic.py index 21a901c091b..0a419955b81 100644 --- a/release/scripts/templates/gamelogic.py +++ b/release/scripts/templates/gamelogic.py @@ -1,10 +1,7 @@ # This script must be assigned to a python controller # where it can access the object that owns it and the sensors/actuators that it connects to. -# GameLogic has been added to the global namespace no need to import - -# for keyboard event comparison -# import GameKeys +import bge # support for Vector(), Matrix() types and advanced functions like Matrix.Scale(...) and Matrix.Rotation(...) # import mathutils @@ -13,7 +10,7 @@ # import Rasterizer def main(): - cont = GameLogic.getCurrentController() + cont = bge.logic.getCurrentController() # The KX_GameObject that owns this controller. own = cont.owner @@ -57,7 +54,7 @@ def main(): # Loop through all other objects in the scene - sce = GameLogic.getCurrentScene() + sce = bge.logic.getCurrentScene() print('Scene Objects:', sce.name) for ob in sce.objects: print(' ', ob.name, ob.worldPosition) diff --git a/release/scripts/templates/gamelogic_basic.py b/release/scripts/templates/gamelogic_basic.py index 5e7d19672fe..c5578a0add9 100644 --- a/release/scripts/templates/gamelogic_basic.py +++ b/release/scripts/templates/gamelogic_basic.py @@ -1,7 +1,8 @@ +import bge def main(): - cont = GameLogic.getCurrentController() + cont = bge.logic.getCurrentController() own = cont.owner sens = cont.sensors['mySensor'] diff --git a/release/scripts/templates/gamelogic_module.py b/release/scripts/templates/gamelogic_module.py index 5a61a3592dc..70bd4d9b45b 100644 --- a/release/scripts/templates/gamelogic_module.py +++ b/release/scripts/templates/gamelogic_module.py @@ -5,7 +5,7 @@ # * External text modules are supported as long as they are at # the same location as the blendfile or one of its libraries. -import GameLogic +import bge # variables defined here will only be set once when the # module is first imported. Set object spesific vars @@ -23,4 +23,4 @@ def main(cont): else: cont.deactivate(actu) -# dont call main(GameLogic.getCurrentController()), the py controller will +# dont call main(bge.logic.getCurrentController()), the py controller will -- cgit v1.2.3