Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // twoSecondBurst, coolDown, etc. are not being updated. They are all integers defined in my GameplayScreen
- // but won't update on my DebuggingTools class. Why is that? What do I need to put in my Debug class?
- // From GameplayScreen, under 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;
- }
- }
- // 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
- //Debug class
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Graphics;
- using Microsoft.Xna.Framework.Content;
- namespace Pong
- {
- class DebuggingTools
- {
- GraphicsDevice graphicsDevice;
- SpriteBatch spriteBatch;
- ContentManager contentManager;
- SpriteFont arial;
- SpriteFont gameFont;
- GameplayScreen gameplayScreen;
- GameTime gameTime;
- // Pass into the GameplayScreen
- private int selectedStage;
- /// <summary>
- /// Constructor
- /// </summary>
- public DebuggingTools()
- {
- gameplayScreen = new GameplayScreen(selectedStage);
- }
- public void LoadContent(ContentManager contentManager)
- {
- arial = contentManager.Load<SpriteFont>(@"gfx/fonts/Arial");
- }
- public void Draw(SpriteBatch spriteBatch)
- {
- //disableTurboCooldown
- spriteBatch.DrawString(arial, string.Format("DTCooldown: {0}", gameplayScreen.disableTurboCooldown),
- new Vector2(20, 60), Color.White);
- //twoSecondBurst
- spriteBatch.DrawString(arial, string.Format("2SecBurst: {0}", gameplayScreen.twoSecondBurst),
- new Vector2(20, 80), Color.White);
- //fiveSecondCoolDown
- spriteBatch.DrawString(arial, string.Format("5SecCD: {0}", gameplayScreen.fiveSecondCoolDown),
- new Vector2(20, 110), Color.White);
- //CoolDown
- spriteBatch.DrawString(arial, string.Format("CoolDown: {0}", gameplayScreen.coolDown),
- new Vector2(20, 140), Color.White);
- }
- public void Update(GameTime gameTime)
- {
- }
- }
- }
RAW Paste Data