Browse Source

added run

Dave Schuyler 21 years ago
parent
commit
579ca6f9eb
2 changed files with 5 additions and 0 deletions
  1. 2 0
      direct/src/controls/ControlManager.py
  2. 3 0
      direct/src/controls/GravityWalker.py

+ 2 - 0
direct/src/controls/ControlManager.py

@@ -27,6 +27,8 @@ class ControlManager:
         self.currentControls = None
         self.currentControls = None
         self.isEnabled = 1
         self.isEnabled = 1
         #self.monitorTask = taskMgr.add(self.monitor, "ControlManager-%s"%(id(self)), priority=-1)
         #self.monitorTask = taskMgr.add(self.monitor, "ControlManager-%s"%(id(self)), priority=-1)
+        inputState.watch("run", "running-on", "running-off")
+        
         inputState.watch("forward", "arrow_up", "arrow_up-up")
         inputState.watch("forward", "arrow_up", "arrow_up-up")
         inputState.watch("forward", "control-arrow_up", "control-arrow_up-up")
         inputState.watch("forward", "control-arrow_up", "control-arrow_up-up")
         inputState.watch("forward", "alt-arrow_up", "alt-arrow_up-up")
         inputState.watch("forward", "alt-arrow_up", "alt-arrow_up-up")

+ 3 - 0
direct/src/controls/GravityWalker.py

@@ -436,6 +436,7 @@ class GravityWalker(DirectObject.DirectObject):
         Check on the arrow keys and update the avatar.
         Check on the arrow keys and update the avatar.
         """
         """
         # get the button states:
         # get the button states:
+        run = inputState.isSet("run")
         forward = inputState.isSet("forward")
         forward = inputState.isSet("forward")
         reverse = inputState.isSet("reverse")
         reverse = inputState.isSet("reverse")
         turnLeft = inputState.isSet("turnLeft")
         turnLeft = inputState.isSet("turnLeft")
@@ -445,6 +446,8 @@ class GravityWalker(DirectObject.DirectObject):
         # Determine what the speeds are based on the buttons:
         # Determine what the speeds are based on the buttons:
         self.speed=(forward and self.avatarControlForwardSpeed or 
         self.speed=(forward and self.avatarControlForwardSpeed or 
                     reverse and -self.avatarControlReverseSpeed)
                     reverse and -self.avatarControlReverseSpeed)
+        if run and self.speed>0.0:
+            self.speed*=2.0 #*#
         # Should fSlide be renamed slideButton?
         # Should fSlide be renamed slideButton?
         self.slideSpeed=slide and (
         self.slideSpeed=slide and (
                 (turnLeft and -self.avatarControlForwardSpeed) or 
                 (turnLeft and -self.avatarControlForwardSpeed) or