Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //// Turbo Stuff
- public int disableTurboCooldown;
- public int twoSecondBurst = 2000;
- public int fiveSecondCoolDown = 5000;
- public int coolDown;
- public void Update()
- {
- ..........
- #region Turbo stuff
- // If spaceBar is down and the turbo bar is not empty, activate turbo. If not, turbo remains off
- if (input.ActivateTurbo(ControllingPlayer))
- {
- if (disableTurboCooldown > 0)
- {
- leftBat.TurboOn();
- coolDown = fiveSecondCoolDown;
- disableTurboCooldown -= gameTime.ElapsedGameTime.Milliseconds;
- }
- else
- {
- leftBat.DisableTurbo();
- }
- }
- // If spacebar is not down, begin to refill the turbo bar
- else
- {
- leftBat.DisableTurbo();
- coolDown -= gameTime.ElapsedGameTime.Milliseconds;
- // If the coolDown timer is not in effect, then the bat can use Turbo again
- if (coolDown < 0)
- {
- disableTurboCooldown = twoSecondBurst;
- coolDown = -gameTime.ElapsedGameTime.Milliseconds;
- }
- }
- // Makes sure that if Turbo is on, it is killd it after () seconds
- if (leftBat.isTurbo)
- {
- disableTurboCooldown -= gameTime.ElapsedGameTime.Milliseconds;
- }
- if (disableTurboCooldown < 0)
- {
- leftBat.isTurbo = false;
- }
- #endregion
- .....
- }
RAW Paste Data