public void UpdatePause(GameTime gameTime) { switch (device) { #region UpdatePause Desktop case CurrentDevice.Desktop: MouseState mouse = Mouse.GetState(); game.IsMouseVisible = true; if (backToGameButton.isClicked == true) { pause = false; Game1.CurrentGameState = Game1.GameState.Playing; backToGameButton.isClicked = false; } else { backToGameButton.Update(mouse); } if (exitButton.isClicked == true) { game.Exit(); } else { exitButton.Update(mouse); } break; #endregion #region UpdatePause Phone case CurrentDevice.Phone: if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { pause = false; Game1.CurrentGameState = Game1.GameState.Playing; } else { changeTransparency(gameTime); } if (Keyboard.GetState().IsKeyDown(Keys.Q)) { game.Exit(); } break; #endregion } }
protected override void Update(GameTime gameTime) { if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { p1.savedata(); // saves the player data this.Exit(); //closes the game } MouseState mouse = Mouse.GetState(); //takes the current state of the mouse switch (CurrentGameState) { case GameState.MainMenu: // checks which mode the code should run if (btnplay.isClicked == true) { CurrentGameState = GameState.Playing; // changes the game mode } btnplay.Update(mouse); // updates the button press break; case GameState.Playing: //checks which game mode if (reset == false) //checks if ame has been reseted yet or not { p1.setposx = int.Parse(data[1]); // sets player position to position when quitting p1.setposy = int.Parse(data[2]); // sets player position to position when quitting reset = true; // sets rest to true so that it doesnt bug } p1.Update(gameTime, mouse); // updates the player enemyM.update(gameTime, p1, map); //update enemies on map break; } if (Keyboard.GetState().IsKeyDown(Keys.F11)) { graphics.ToggleFullScreen(); } // toggles fulscreen on press foreach (Blocks tile in map.AllBlocks) { p1.Collision(tile.BlockRekt, map.Height, map.Width); // checks block colision for every block camera.Update(p1.Pos, map.Width, map.Height); // updates the camera } hp = p1.hpcheck(); // updates the text above player head of the player health GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap; base.Update(gameTime); //updates the game }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } MouseState mouse = Mouse.GetState(); switch (CurrentGameState) { case GameState.MainMenu: if (btnPlay.isClicked == true) { CurrentGameState = GameState.Playing; } btnPlay.Update(mouse); break; case GameState.Playing: break; } Marcel_Basis.Update(gameTime); Marco_Basis.Update(gameTime); Marc_Basis.Update(gameTime); Paul_Basis.Update(gameTime); Eljakim_Basis.Update(gameTime); /* TODO: Add your update logic here * * * * */ base.Update(gameTime); }
public void UpdateMainMenu(GameTime gameTime) { switch (device) { #region UpdateMainMenu Desktop case CurrentDevice.Desktop: game.IsMouseVisible = true; mainMenu.Update(gameTime); MouseState mouse = Mouse.GetState(); var touchPanelState = TouchPanel.GetState(); if (touchPanelState.Count >= 1) { Game1.CurrentGameState = Game1.GameState.Playing; } if (btnPlay.isClicked == true) { Game1.CurrentGameState = Game1.GameState.Playing; } btnPlay.Update(mouse); break; #endregion #region UpdateMainMenu Phone case CurrentDevice.Phone: if (Keyboard.GetState().IsKeyDown(Keys.Enter)) { Game1.CurrentGameState = Game1.GameState.Playing; } else { changeTransparency(gameTime); } break; #endregion } }