public override void HandleInput(GameTime gameTime, InputState input) { if (input == null) { throw new ArgumentNullException("input"); } // Look up inputs for the active player profile. int playerIndex = (int)ControllingPlayer.Value; KeyboardState keyboardState = input.CurrentKeyboardStates[playerIndex]; GamePadState gamePadState = input.CurrentGamePadStates[playerIndex]; // The game pauses either if the user presses the pause button, or if // they unplug the active gamepad. This requires us to keep track of // whether a gamepad was ever plugged in, because we don't want to pause // on PC if they are playing with a keyboard and have no gamepad at all! bool gamePadDisconnected = !gamePadState.IsConnected && input.GamePadWasConnected[playerIndex]; PlayerIndex player; if (pauseAction.Evaluate(input, ControllingPlayer, out player) || gamePadDisconnected) { bloom.Visible = false; ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayer); } else { if (keyboardState.IsKeyDown(Keys.A) || gamePadState.Buttons.A == ButtonState.Pressed) { if (levelFrom == 1) { ExitScreen(); bloom.Visible = false; LoadingScreen.Load(ScreenManager, false, ControllingPlayer, new GameplayScreen()); } else if (levelFrom == 2) { ExitScreen(); bloom.Visible = false; LoadingScreen.Load(ScreenManager, false, ControllingPlayer, new level2Screen()); } else if (levelFrom == 3) { ExitScreen(); bloom.Visible = false; LoadingScreen.Load(ScreenManager, false, ControllingPlayer, new level3Screen()); } else if (levelFrom == 0) { ExitScreen(); bloom.Visible = false; LoadingScreen.Load(ScreenManager, false, ControllingPlayer, new TutLevel1()); } } // enter or a is continue // b or esc is back ect } }
/// <summary> /// Updates the state of the game. This method checks the GameScreen.IsActive /// property, so the game will stop updating when the pause menu is active, /// or if you tab away to a different application. /// </summary> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, false); // Gradually fade in or out depending on whether we are covered by the pause screen. if (coveredByOtherScreen) { pauseAlpha = Math.Min(pauseAlpha + 1f / 32, 1); } else { pauseAlpha = Math.Max(pauseAlpha - 1f / 32, 0); } if (IsActive) { bloom.Visible = true; playerBody.update(); //game script { if (Collectables.Count == 1 && ninjaGateRemoved == false) { world.RemoveBody(ninjaGate.shapeBody); Shapes.Remove(ninjaGate);// for some reason I had to create a ninja gate object and not just add an object to the list ninjaGateRemoved = true; } if (Collectables.Count == 0) { Game1.progress = 1; ScreenManager.RemoveScreen(this); // the pause system screws up when we have the reloaded game screen. // but should be ok when we have a new level LoadingScreen.Load(ScreenManager, true, PlayerIndex.One, new GameplayScreen()); } } bloom.Settings = BloomSettings.PresetSettings[bloomSettingsIndex]; foreach (Shape shape in Shapes) { if (shape.isTouching) { playerBody.isAlive = false; } shape.update(); } foreach (Square square in Squares) { square.Update(); if (square.isTouching) { playerBody.isAlive = false; } } foreach (Bady bady in Badies) { foreach (Laser laser in bady.Lasers) { if (laser.hasHit) { playerBody.isAlive = false; } } bady.Update(gameTime); } foreach (Whip whip in Whips) { whip.chainLinks[0].ApplyTorque(50); // gets the wheel spinning // for some reason this is true on start up. if (whip.isTouching) { playerBody.isAlive = false; } } // Collectables { foreach (Collectable collectable in Collectables) { collectable.Update(); } //remove collected collectables for (int k = 0; k < Collectables.Count; k++) { if (Collectables[k].collected) { world.RemoveBody(Collectables[k].collectableBody); Collectables.RemoveAt(k); } } } // limts on the cam. cam2D.MaxRotation = 0.001f; cam2D.MinRotation = -0.001f; cam2D.MaxPosition = new Vector2(((playerBody.playerBody.Position.X) * 64 + 1), ((playerBody.playerBody.Position.Y) * 64) + 1); cam2D.MinPosition = new Vector2(((playerBody.playerBody.Position.X) * 64) + 2, ((playerBody.playerBody.Position.Y) * 64) + 1); cam2D.Update(gameTime); if (!playerBody.isAlive) { bloom.Visible = false; LoadingScreen.Load(ScreenManager, false, PlayerIndex.One, new DeadScreen(1)); } world.Step((float)gameTime.ElapsedGameTime.TotalMilliseconds * 0.001f); } }
/// <summary> /// Updates the state of the game. This method checks the GameScreen.IsActive /// property, so the game will stop updating when the pause menu is active, /// or if you tab away to a different application. /// </summary> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, false); // Gradually fade in or out depending on whether we are covered by the pause screen. if (coveredByOtherScreen) { pauseAlpha = Math.Min(pauseAlpha + 1f / 32, 1); } else { pauseAlpha = Math.Max(pauseAlpha - 1f / 32, 0); } if (IsActive) { mouse = Mouse.GetState(); // bloom bloom.Visible = true; bloom.Settings = BloomSettings.PresetSettings[bloomSettingsIndex]; // update entites playerBody.update(gameTime); foreach (Collectable star in Collectables) { if (star.collected) { playerBody.updateScore(2); world.RemoveBody(star.collectableBody); } } for (int k = 0; k < Collectables.Count; ++k) { if (Collectables[k].collected) { Collectables.RemoveAt(k); } } foreach (SeekerDrone drone in Drones) { drone.setTarget(playerBody.playerBody.Position * 64); drone.update(gameTime); if (drone.getIsDead) { world.RemoveBody(drone.getBody); playerBody.updateScore(2); /// updater this to a getter and setter!!! } } for (int k = 0; k < Drones.Count; ++k) { if (Drones[k].getIsDead) { Drones.RemoveAt(k); } } foreach (Square square in Squares) { square.Update(); if (square.isTouching) { playerBody.isAlive = false; } } if (playerBody.isAlive == false) { bloom.Visible = false; world.Clear(); this.ExitScreen(); bloom.Visible = false; LoadingScreen.Load(ScreenManager, false, PlayerIndex.One, new DeadScreen(2)); } //game script if (playerBody.getScore() == 12 && Collectables.Count == 0) { Collectables.Add(new Collectable(content.Load <Texture2D>("redStar"), new Vector2(400, 400), world)); } if (playerBody.getScore() == 14) { ExitScreen(); bloom.Visible = false; LoadingScreen.Load(ScreenManager, false, PlayerIndex.One, new level3Screen()); } // limts on the cam. cam2D.MaxRotation = 0.001f; cam2D.MinRotation = -0.001f; cam2D.MaxPosition = new Vector2(((playerBody.playerBody.Position.X) * 64 + 1), ((playerBody.playerBody.Position.Y) * 64) + 1); cam2D.MinPosition = new Vector2(((playerBody.playerBody.Position.X) * 64) + 2, ((playerBody.playerBody.Position.Y) * 64) + 1); cam2D.Update(gameTime); world.Step((float)gameTime.ElapsedGameTime.TotalMilliseconds * 0.001f); } }
/// <summary> /// Event handler for when the user selects ok on the "are you sure /// you want to quit" message box. This uses the loading screen to /// transition from the game back to the main menu screen. /// </summary> void ConfirmQuitMessageBoxAccepted(object sender, PlayerIndexEventArgs e) { LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new MainMenuScreen()); }
/// <summary> /// Updates the state of the game. This method checks the GameScreen.IsActive /// property, so the game will stop updating when the pause menu is active, /// or if you tab away to a different application. /// </summary> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, false); // Gradually fade in or out depending on whether we are covered by the pause screen. if (coveredByOtherScreen) { pauseAlpha = Math.Min(pauseAlpha + 1f / 32, 1); } else { pauseAlpha = Math.Max(pauseAlpha - 1f / 32, 0); } if (IsActive) { mouse = Mouse.GetState(); // bloom bloom.Visible = true; bloom.Settings = BloomSettings.PresetSettings[bloomSettingsIndex]; // update entites playerBody.update(gameTime); if (playerBody.isAlive == false) { bloom.Visible = false; world.Clear(); this.ExitScreen(); LoadingScreen.Load(ScreenManager, false, PlayerIndex.One, new DeadScreen(2)); } //game script foreach (Pickupable pickupable in Pickupables) { if (pickupable.getSetIsTouchingPlayer && playerBody.getSetWantsToPickUp && !playerBody.getSetHasPickedUp) { // joints.Add ( JointFactory.CreateRevoluteJoint(world,playerBody.playerBody, // pickupable.getBody, new Vector2(0,0))); joints.Add(JointFactory.CreateDistanceJoint(world, playerBody.playerBody, pickupable.getBody, new Vector2(0, 0), new Vector2(0, 0))); playerBody.getSetWantsToPickUp = false; pickupable.getSetIsAttachedToPlayer = true; playerBody.getSetHasPickedUp = true; } if (joints.Count > 0 && playerBody.getSetWantsTodrop && playerBody.getSetHasPickedUp && pickupable.getSetIsAttachedToPlayer) { // for some reason the on seperation dosn't work when removing a joint. world.RemoveJoint(joints[0]); joints.RemoveAt(0); playerBody.getSetHasPickedUp = false; pickupable.getSetIsAttachedToPlayer = false; pickupable.getSetIsTouchingPlayer = false; } } // limts on the cam. cam2D.MaxRotation = 0.001f; cam2D.MinRotation = -0.001f; cam2D.MaxPosition = new Vector2(((playerBody.playerBody.Position.X) * 64 + 1), ((playerBody.playerBody.Position.Y) * 64) + 1); cam2D.MinPosition = new Vector2(((playerBody.playerBody.Position.X) * 64) + 2, ((playerBody.playerBody.Position.Y) * 64) + 1); cam2D.Update(gameTime); world.Step((float)gameTime.ElapsedGameTime.TotalMilliseconds * 0.001f); } }
void level1_Selected(object sender, PlayerIndexEventArgs e) { LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, new GameplayScreen()); }
/// <summary> /// Updates the state of the game. This method checks the GameScreen.IsActive /// property, so the game will stop updating when the pause menu is active, /// or if you tab away to a different application. /// </summary> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, false); // Gradually fade in or out depending on whether we are covered by the pause screen. if (coveredByOtherScreen) { pauseAlpha = Math.Min(pauseAlpha + 1f / 32, 1); } else { pauseAlpha = Math.Max(pauseAlpha - 1f / 32, 0); } if (IsActive) { bloom.Visible = true; //game script { if (Collectables.Count == 1 && ninjaGateRemoved == false) { world.RemoveBody(ninjaGate.shapeBody); Shapes.Remove(ninjaGate);// for some reason I had to create a ninja gate object and not just add an object to the list ninjaGateRemoved = true; } if (Collectables.Count == 0) { Game1.progress = 1; Game1.setScore(playerBody.getScore(), 1); ExitScreen(); bloom.Visible = false; LoadingScreen.Load(ScreenManager, false, ControllingPlayer, new level2Screen()); } } bloom.Settings = BloomSettings.PresetSettings[bloomSettingsIndex]; foreach (Shape shape in Shapes) { if (shape.isTouching) { MediaPlayer.Pause(); ExitScreen(); bloom.Visible = false; LoadingScreen.Load(ScreenManager, false, ControllingPlayer, new DeadScreen(1)); } shape.update(); } foreach (Square square in Squares) { square.Update(); if (square.isTouching) { MediaPlayer.Pause(); ExitScreen(); bloom.Visible = false; LoadingScreen.Load(ScreenManager, false, ControllingPlayer, new DeadScreen(1)); // ScreenManager.AddScreen(new MessageBoxScreen("You've picked up a power up!"),ControllingPlayer); } } foreach (Bady bady in Badies) { foreach (Laser laser in bady.Lasers) { if (laser.hasHit) { MediaPlayer.Pause(); ExitScreen(); bloom.Visible = false; LoadingScreen.Load(ScreenManager, false, ControllingPlayer, new DeadScreen(1)); } } if (bady.hitByPlayerLaser) { List <playerLaser> playerLasers = playerBody.getLasers; for (int k = 0; k < playerLasers.Count; ++k) { if (bady.playerLaserBody.Equals(playerLasers[k].laserBody)) { bady.deltaHealth = playerLasers[k].getDamage; } } } bady.Update(gameTime); } for (int k = 0; k < Badies.Count; k++) { if (Badies[k].isDead) { Badies.RemoveAt(k); playerBody.updateScore(1); } } foreach (Whip whip in Whips) { whip.chainLinks[0].ApplyTorque(50); // gets the wheel spinning if (whip.isTouching) // for some reason this is true on start up { MediaPlayer.Pause(); ExitScreen(); bloom.Visible = false; LoadingScreen.Load(ScreenManager, false, ControllingPlayer, new DeadScreen(1)); } } // Collectables { foreach (Collectable collectable in Collectables) { collectable.Update(); } //remove collected collectables for (int k = 0; k < Collectables.Count; k++) { if (Collectables[k].collected) { world.RemoveBody(Collectables[k].collectableBody); Collectables.RemoveAt(k); playerBody.updateScore(2); } } } playerBody.update(gameTime); // limts on the cam. cam2D.MaxRotation = 0.001f; cam2D.MinRotation = -0.001f; cam2D.MaxPosition = new Vector2(((playerBody.playerBody.Position.X) * 64 + 1), ((playerBody.playerBody.Position.Y) * 64) + 1); cam2D.MinPosition = new Vector2(((playerBody.playerBody.Position.X) * 64) + 2, ((playerBody.playerBody.Position.Y) * 64) + 1); cam2D.Update(gameTime); world.Step((float)gameTime.ElapsedGameTime.TotalMilliseconds * 0.001f); } }
void test1_Selected(object sender, PlayerIndexEventArgs e) { LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, new TestingPickupable()); }
void tutlevel_Selected(object sender, PlayerIndexEventArgs e) { LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, new TutLevel1()); }
void levelEditEntrySelected(object sender, PlayerIndexEventArgs e) { LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, new LevelEditor()); }
void chapterOne_Selected(object sender, PlayerIndexEventArgs e) { LoadingScreen.Load(ScreenManager, true, PlayerIndex.One, new ChapterOne()); }
/// <summary> /// Updates the state of the game. This method checks the GameScreen.IsActive /// property, so the game will stop updating when the pause menu is active, /// or if you tab away to a different application. /// </summary> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, false); // Gradually fade in or out depending on whether we are covered by the pause screen. if (coveredByOtherScreen) { pauseAlpha = Math.Min(pauseAlpha + 1f / 32, 1); } else { pauseAlpha = Math.Max(pauseAlpha - 1f / 32, 0); } if (IsActive) { mouse = Mouse.GetState(); // bloom bloom.Visible = true; bloom.Settings = BloomSettings.PresetSettings[bloomSettingsIndex]; // update entites playerBody.update(gameTime); Drones[0].setTarget(playerBody.playerBody.Position * 64); foreach (SeekerDrone drone in Drones) { drone.update(gameTime); } foreach (Pickupable pickupable in pickuables) { if (pickupable.getSetIsTouchingPlayer && playerBody.getSetWantsToPickUp && !playerBody.getSetHasPickedUp) { Joints.Add(JointFactory.CreateDistanceJoint(world, playerBody.playerBody, pickupable.getBody, new Vector2(0, 0), new Vector2(0, 0))); playerBody.getSetWantsToPickUp = false; pickupable.getSetIsAttachedToPlayer = true; playerBody.getSetHasPickedUp = true; } if (Joints.Count > 0 && playerBody.getSetWantsTodrop && playerBody.getSetHasPickedUp && pickupable.getSetIsAttachedToPlayer) { // for some reason the on seperation dosn't work when removing a joint. So we force the pickupable to not touching the player world.RemoveJoint(Joints[0]); Joints.RemoveAt(0); playerBody.getSetHasPickedUp = false; pickupable.getSetIsAttachedToPlayer = false; pickupable.getSetIsTouchingPlayer = false; } } if (playerBody.isAlive == false) { bloom.Visible = false; world.Clear(); this.ExitScreen(); LoadingScreen.Load(ScreenManager, false, PlayerIndex.One, new DeadScreen(2)); } //game script if (hasMovedPickUp == false) { if (Areas[0].getIsPickUpTouching && playerBody.getSetHasPickedUp == false) { hasMovedPickUp = true; Collectables.Add(new Collectable(content.Load <Texture2D>("redStar"), new Vector2(0, 300), world)); Areas.RemoveAt(0); pickuables.RemoveAt(0); WallBoxes[0].removeWalls(); WallBoxes.RemoveAt(0); } } for (int k = 0; k < Collectables.Count; ++k) { if (Collectables[k].Collected) { Collectables.RemoveAt(k); } } if (hasMovedPickUp) { if (Collectables.Count == 0) { bloom.Visible = false; ExitScreen(); } } // limts on the cam. cam2D.MaxRotation = 0.001f; cam2D.MinRotation = -0.001f; cam2D.MaxPosition = new Vector2(((playerBody.playerBody.Position.X) * 64 + 1), ((playerBody.playerBody.Position.Y) * 64) + 1); cam2D.MinPosition = new Vector2(((playerBody.playerBody.Position.X) * 64) + 2, ((playerBody.playerBody.Position.Y) * 64) + 1); cam2D.Update(gameTime); world.Step((float)gameTime.ElapsedGameTime.TotalMilliseconds * 0.001f); } }
/// <summary> /// Updates the state of the game. This method checks the GameScreen.IsActive /// property, so the game will stop updating when the pause menu is active, /// or if you tab away to a different application. /// </summary> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, false); // Gradually fade in or out depending on whether we are covered by the pause screen. if (coveredByOtherScreen) { pauseAlpha = Math.Min(pauseAlpha + 1f / 32, 1); } else { pauseAlpha = Math.Max(pauseAlpha - 1f / 32, 0); } if (IsActive) { mouse = Mouse.GetState(); // bloom bloom.Visible = true; bloom.Settings = BloomSettings.PresetSettings[bloomSettingsIndex]; // update entites playerBody.update(gameTime); foreach (Pickupable pickupable in pickuables) { if (pickupable.getSetIsTouchingPlayer && playerBody.getSetWantsToPickUp && !playerBody.getSetHasPickedUp) { // joints.Add ( JointFactory.CreateRevoluteJoint(world,playerBody.playerBody, // pickupable.getBody, new Vector2(0,0))); Joints.Add(JointFactory.CreateDistanceJoint(world, playerBody.playerBody, pickupable.getBody, new Vector2(0, 0), new Vector2(0, 0))); playerBody.getSetWantsToPickUp = false; pickupable.getSetIsAttachedToPlayer = true; playerBody.getSetHasPickedUp = true; } if (Joints.Count > 0 && playerBody.getSetWantsTodrop && playerBody.getSetHasPickedUp && pickupable.getSetIsAttachedToPlayer) { // for some reason the on seperation dosn't work when removing a joint. So we force the pickupable to not touching the player world.RemoveJoint(Joints[0]); Joints.RemoveAt(0); playerBody.getSetHasPickedUp = false; pickupable.getSetIsAttachedToPlayer = false; pickupable.getSetIsTouchingPlayer = false; } } if (playerBody.isAlive == false) { bloom.Visible = false; world.Clear(); this.ExitScreen(); LoadingScreen.Load(ScreenManager, false, PlayerIndex.One, new DeadScreen(0)); } //game script if (GreenTestStarted == false) { Timer += gameTime.ElapsedGameTime.Milliseconds; } if (Timer > timerForGreenTest && GreenTestStarted == false && MediaPlayer.State == MediaState.Stopped) { Timer = 0; GreenTestStarted = true; UI.setSub = "Welcome my name is Vivi. Move to and touch the red square to continue."; Squares.Add(new Square(content.Load <Texture2D>("Squares/redSquare"), new Vector2(800, 100), true, world)); // MediaPlayer.Play(Welcome); WelcomeSFXInstance.Play(); } if (GreenTestStarted == true && GreenTestComplete == false) { if (Squares[0].isTouching) { GreenTestComplete = true; BlueTestStarted = true; UI.setSub = "Wonderful, now fire your laser at the blue square."; // MediaPlayer.Play(Blue); if (WelcomeSFXInstance.State == SoundState.Stopped) { WelcomeSFXInstance.Stop(); BlueSFX.Play(); } Squares.Add(new Square(content.Load <Texture2D>("Squares/blueSquare"), new Vector2(100, 500), true, world)); playerBody.getSetLaserStatus = true; world.RemoveBody(Squares[0].squareBody); Squares.RemoveAt(0); } } if (BlueTestStarted && BlueTestComplete == false) { if (Squares[0].isTouchingLaser) { BlueTestComplete = true; world.RemoveBody(Squares[0].squareBody); Squares.RemoveAt(0); UI.setSub = "Excellent, now pick up and move the pink square into the pink area."; // MediaPlayer.Play(Pink); PinkSFX.Play(); pickuables.Add(new Pickupable(content.Load <Texture2D>("Squares/pinkSquare"), new Vector2(10, 50), world)); Areas.Add(new Area(content.Load <Texture2D>("pinkArea"), new Vector2(800, 500), 1.57f, world)); Timer = 0; } } if (BlueTestComplete && GreenTestComplete) { PinkTestStarted = true; if (PinkTestCompleted == false) { if (Areas[0].getIsPickUpTouching && playerBody.getSetHasPickedUp == false) { PinkTestCompleted = true; pickuables.RemoveAt(0); Areas.RemoveAt(0); } } } // need to add bool for sound fx here. if (PinkTestCompleted && UI.Acitve == false && countDownStated == false) { if (questionsSpoken == false) { UI.setSub = "You are confirmed operational. Remember only blue, red and pink neon is safe to touch. Questions?"; QuestionsSFX.Play(); questionsSpoken = true; } Timer += gameTime.ElapsedGameTime.Milliseconds; if (Timer > 2500) { UI.Acitve = true; playerBody.getSetChoicePoint = true; countDownStated = true; Timer = 0; } } if (BlueTestComplete && GreenTestComplete && PinkTestCompleted && pressedOk == false) { if (playerBody.choiceValue == 2 && questionOneAsked == false) { UI.setSub = "You are designated as an Operational Perpetuating Organism. Or Opo."; UI.setTextA = "Ok, let's go!"; OpoSFXInstance.Play(); questionOneAsked = true; } else if (playerBody.choiceValue == 3 && questionTwoAsked == false) { UI.setSub = "You are in the System."; UI.setTextA = "Ok, let's go!"; SystemSFXInstance.Play(); questionTwoAsked = true; } else if (playerBody.choiceValue == 1) { pressedOk = true; UI.Acitve = false; UI.setSub = "Loading progress tracker."; Timer = 0; iniProgressSFXInstance.Play(); } } if (pressedOk && progressLoaded == false) { Timer += gameTime.ElapsedGameTime.Milliseconds; if (iniProgressSFXInstance.State != SoundState.Playing && sayThree == false) { UI.setSub = "Three..."; ThreeSFXInstance.Play(); sayThree = true; } if (ThreeSFXInstance.State != SoundState.Playing && sayTwo == false) { UI.setSub = "Two..."; TwoSFXInstance.Play(); sayTwo = true; } if (TwoSFXInstance.State != SoundState.Playing && sayOne == false) { UI.setSub = "One..."; OneSFXInstance.Play(); sayOne = true; } if (OneSFXInstance.State != SoundState.Playing) { UI.setSub = "Progress module loaded."; progressLoadedSFXInstance.Play(); playerBody.getSetDrawScore = true; progressLoaded = true; Timer = 0; } } if (progressLoaded) { Timer += gameTime.ElapsedGameTime.Milliseconds; if (Timer > 2000 && Timer < 4000 && EntryPointSFXInstance.State != SoundState.Playing) { UI.setSub = "Loading courpution entry point."; EntryPointSFXInstance.Play(); } if (Timer > 4000 && Timer < 6000 && ThreeSFXInstance.State != SoundState.Playing) { UI.setSub = "Three..."; ThreeSFXInstance.Play(); } if (Timer > 6000 && Timer < 8000 && TwoSFXInstance.State != SoundState.Playing) { UI.setSub = "Two..."; TwoSFXInstance.Play(); } if (Timer > 8000 && Timer < 10000 && OneSFXInstance.State != SoundState.Playing) { UI.setSub = "One..."; OneSFXInstance.Play(); } if (Timer > 10000) { bloom.Visible = false; ExitScreen(); LoadingScreen.Load(ScreenManager, true, PlayerIndex.One, new ChapterOne()); } } // limts on the cam. cam2D.MaxRotation = 0.001f; cam2D.MinRotation = -0.001f; cam2D.MaxPosition = new Vector2(((playerBody.playerBody.Position.X) * 64 + 1), ((playerBody.playerBody.Position.Y) * 64) + 1); cam2D.MinPosition = new Vector2(((playerBody.playerBody.Position.X) * 64) + 2, ((playerBody.playerBody.Position.Y) * 64) + 1); cam2D.Update(gameTime); world.Step((float)gameTime.ElapsedGameTime.TotalMilliseconds * 0.001f); } }
/// <summary> /// Updates the state of the game. This method checks the GameScreen.IsActive /// property, so the game will stop updating when the pause menu is active, /// or if you tab away to a different application. /// </summary> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, false); // Gradually fade in or out depending on whether we are covered by the pause screen. if (coveredByOtherScreen) { pauseAlpha = Math.Min(pauseAlpha + 1f / 32, 1); } else { pauseAlpha = Math.Max(pauseAlpha - 1f / 32, 0); } if (IsActive) { mouse = Mouse.GetState(); // bloom bloom.Visible = true; bloom.Settings = BloomSettings.PresetSettings[bloomSettingsIndex]; foreach (Square square in Squares) { square.Update(); if (square.isTouching) { playerBody.isAlive = false; } } // update entites playerBody.update(gameTime); spinningWheel.shapeBody.IsStatic = false; if (spinningWheel.shapeBody.AngularVelocity < 0.5) { spinningWheel.shapeBody.ApplyTorque(0.1f); } if (playerBody.isAlive == false) { bloom.Visible = false; world.Clear(); this.ExitScreen(); LoadingScreen.Load(ScreenManager, false, PlayerIndex.One, new DeadScreen(3)); } //game script // limts on the cam. cam2D.MaxRotation = 0.001f; cam2D.MinRotation = -0.001f; cam2D.MaxPosition = new Vector2(((playerBody.playerBody.Position.X) * 64 + 1), ((playerBody.playerBody.Position.Y) * 64) + 1); cam2D.MinPosition = new Vector2(((playerBody.playerBody.Position.X) * 64) + 2, ((playerBody.playerBody.Position.Y) * 64) + 1); cam2D.Update(gameTime); world.Step((float)gameTime.ElapsedGameTime.TotalMilliseconds * 0.001f); } }