Guest User

Untitled

a guest
Aug 1st, 2012
32
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         //// Turbo Stuff
  2.         public int disableTurboCooldown;
  3.         public int twoSecondBurst = 2000;
  4.         public int fiveSecondCoolDown = 5000;
  5.         public int coolDown;                  
  6.  
  7. public void Update()
  8. {
  9. ..........
  10.   #region Turbo stuff
  11.                     // If spaceBar is down and the turbo bar is not empty, activate turbo. If not, turbo remains off
  12.                     if (input.ActivateTurbo(ControllingPlayer))
  13.                     {
  14.                         if (disableTurboCooldown > 0)
  15.                         {
  16.                             leftBat.TurboOn();
  17.                             coolDown = fiveSecondCoolDown;
  18.                             disableTurboCooldown -= gameTime.ElapsedGameTime.Milliseconds;
  19.                         }
  20.                         else
  21.                         {
  22.                             leftBat.DisableTurbo();
  23.                         }
  24.                     }
  25.  
  26.                         // If spacebar is not down, begin to refill the turbo bar
  27.                     else
  28.                     {
  29.                         leftBat.DisableTurbo();
  30.                         coolDown -= gameTime.ElapsedGameTime.Milliseconds;
  31.                         // If the coolDown timer is not in effect, then the bat can use Turbo again
  32.                         if (coolDown < 0)
  33.                         {
  34.                             disableTurboCooldown = twoSecondBurst;
  35.                             coolDown = -gameTime.ElapsedGameTime.Milliseconds;
  36.                         }
  37.                     }
  38.  
  39.                     // Makes sure that if Turbo is on, it is killd it after () seconds
  40.                     if (leftBat.isTurbo)
  41.                     {
  42.                         disableTurboCooldown -= gameTime.ElapsedGameTime.Milliseconds;
  43.                     }
  44.  
  45.                     if (disableTurboCooldown < 0)
  46.                     {
  47.                         leftBat.isTurbo = false;
  48.                     }
  49.  
  50.                     #endregion
  51. .....
  52. }
RAW Paste Data