Guest User

Untitled

a guest
Jul 31st, 2012
32
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // twoSecondBurst, coolDown, etc. are not being updated. They are all integers defined in my GameplayScreen
  2. // but won't update on my DebuggingTools class. Why is that? What do I need to put in my Debug class?
  3.  
  4. // From GameplayScreen, under Update:
  5.  
  6.        #region Turbo stuff
  7.  
  8.                     // If spaceBar is down and the turbo bar is not empty, activate turbo. If not, turbo remains off
  9.                     if (input.ActivateTurbo(ControllingPlayer))
  10.                     {
  11.                         if (disableTurboCooldown > 0)
  12.                         {
  13.                             leftBat.TurboOn();
  14.                             coolDown = fiveSecondCoolDown;
  15.                             disableTurboCooldown -= gameTime.ElapsedGameTime.Milliseconds;
  16.                         }
  17.                         else
  18.                         {
  19.                             leftBat.DisableTurbo();
  20.                         }
  21.                     }
  22.  
  23.                         // If spacebar is not down, begin to refill the turbo bar
  24.                     else
  25.                     {
  26.                         leftBat.DisableTurbo();
  27.                         coolDown -= gameTime.ElapsedGameTime.Milliseconds;
  28.                         // If the coolDown timer is not in effect, then the bat can use Turbo again
  29.                         if (coolDown < 0)
  30.                         {
  31.                             disableTurboCooldown = twoSecondBurst;
  32.                         }
  33.                     }
  34.  
  35.                     // Makes sure that if Turbo is on, it is killd it after () seconds
  36.                     if (leftBat.isTurbo)
  37.                     {
  38.                         disableTurboCooldown -= gameTime.ElapsedGameTime.Milliseconds;
  39.                     }
  40.  
  41.                     if (disableTurboCooldown < 0)
  42.                     {
  43.                         leftBat.isTurbo = false;
  44.                     }
  45.  
  46.                     #endregion
  47.  
  48.  
  49. //Debug class
  50.  
  51.  
  52. using System;
  53. using System.Collections.Generic;
  54. using System.Linq;
  55. using System.Text;
  56.  
  57. using Microsoft.Xna.Framework;
  58. using Microsoft.Xna.Framework.Graphics;
  59. using Microsoft.Xna.Framework.Content;
  60.  
  61.  
  62. namespace Pong
  63. {
  64.     class DebuggingTools
  65.     {
  66.  
  67.         GraphicsDevice graphicsDevice;
  68.         SpriteBatch spriteBatch;
  69.         ContentManager contentManager;
  70.         SpriteFont arial;
  71.         SpriteFont gameFont;
  72.         GameplayScreen gameplayScreen;
  73.         GameTime gameTime;
  74.      
  75.         // Pass into the GameplayScreen
  76.         private int selectedStage;
  77.  
  78.         /// <summary>
  79.         /// Constructor
  80.         /// </summary>
  81.         public DebuggingTools()
  82.         {
  83.             gameplayScreen = new GameplayScreen(selectedStage);
  84.         }
  85.  
  86.         public void LoadContent(ContentManager contentManager)
  87.         {
  88.             arial = contentManager.Load<SpriteFont>(@"gfx/fonts/Arial");
  89.         }
  90.  
  91.         public void Draw(SpriteBatch spriteBatch)
  92.         {
  93.             //disableTurboCooldown
  94.             spriteBatch.DrawString(arial, string.Format("DTCooldown: {0}", gameplayScreen.disableTurboCooldown),
  95.             new Vector2(20, 60), Color.White);
  96.  
  97.             //twoSecondBurst
  98.             spriteBatch.DrawString(arial, string.Format("2SecBurst: {0}", gameplayScreen.twoSecondBurst),
  99.             new Vector2(20, 80), Color.White);
  100.  
  101.             //fiveSecondCoolDown
  102.             spriteBatch.DrawString(arial, string.Format("5SecCD: {0}", gameplayScreen.fiveSecondCoolDown),
  103.             new Vector2(20, 110), Color.White);
  104.  
  105.             //CoolDown
  106.             spriteBatch.DrawString(arial, string.Format("CoolDown: {0}", gameplayScreen.coolDown),
  107.             new Vector2(20, 140), Color.White);
  108.  
  109.         }
  110.  
  111.         public void Update(GameTime gameTime)
  112.         {
  113.         }
  114.  
  115.     }
  116. }
RAW Paste Data