/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (Game1 game = new Game1()) { game.Run(); } }
public GameMode UpdateCredits(Game1 game) { GameInput currentInputState = GameInput.GetState(); if (currentInputState.ExitButton == ButtonState.Pressed && _PreviousInputState.ExitButton == ButtonState.Released) return GameMode.Menu; return GameMode.Credits; }
public GameMode Update(GameTime gameTime, Game1 game) { ProcessKeyboard(gameTime); float moveSpeed = gameTime.ElapsedGameTime.Milliseconds / 500.0f * gameSpeed; moveSpeed *= (MaxSpeed * curAcc); MoveForward(ref buggyPosition, buggyRotation, moveSpeed); hud.Update(game); buggySpeed = moveSpeed; UpdateCamera(); return GameMode.Play; }
public GameMode Update(Game1 game) { GameInput currentInputState = GameInput.GetState(); // This should cause the selected menu item to "scroll" up or down // depending on what D-Pad button is pressed. if (currentInputState.DownButton == ButtonState.Pressed && _PreviousInputState.DownButton == ButtonState.Released) { Sound.Play(Sound.Sounds.MenuMove); if (_SelectedMenuItem == _TotalMenuItems) _SelectedMenuItem = 0; else _SelectedMenuItem++; } else if (currentInputState.UpButton == ButtonState.Pressed && _PreviousInputState.UpButton == ButtonState.Released) { Sound.Play(Sound.Sounds.MenuMove); if (_SelectedMenuItem == 0) _SelectedMenuItem = _TotalMenuItems; else _SelectedMenuItem--; } if (currentInputState.SelectButton == ButtonState.Pressed && _PreviousInputState.SelectButton == ButtonState.Released) { Sound.Play(Sound.Sounds.MenuSelect); switch (_SelectedMenuItem) { case 0://Play return GameMode.Play; case 1://Options return GameMode.Options; case 2://Credits return GameMode.Credits; case 3://Exit game.Exit(); break; } } // Set the previous state to the current input state at // the end so that the next time this method is called, // the state can be compared _PreviousInputState = currentInputState; return GameMode.Menu; }//Update()
public GameMode UpdateOptions(Game1 game) { GameInput currentInputState = GameInput.GetState(); if (currentInputState.DownButton == ButtonState.Pressed && _PreviousInputState.DownButton == ButtonState.Released) { Sound.Play(Sound.Sounds.MenuMove); if (_SelectedOptionItem == _TotalOptionItems) _SelectedOptionItem = 0; else _SelectedOptionItem++; } else if (currentInputState.UpButton == ButtonState.Pressed && _PreviousInputState.UpButton == ButtonState.Released) { Sound.Play(Sound.Sounds.MenuMove); if (_SelectedOptionItem == 0) _SelectedOptionItem = _TotalOptionItems; else _SelectedOptionItem--; } if (currentInputState.SelectButton == ButtonState.Pressed && _PreviousInputState.SelectButton == ButtonState.Released) { Sound.Play(Sound.Sounds.MenuSelect); switch (_SelectedOptionItem) { case 0://Off Sound.StartMusic(); break; case 1://On Sound.StopMusic(); break; } } else if (currentInputState.ExitButton == ButtonState.Pressed && _PreviousInputState.ExitButton == ButtonState.Released) return GameMode.Menu; // Set the previous state to the current input state at // the end so that the next time this method is called, // the state can be compared _PreviousInputState = currentInputState; return GameMode.Options; }
public Graphics(Game1 game) { graphics = new GraphicsDeviceManager(game); }
/// <summary> /// Updates the HUD /// </summary> /// <param name="game">Game Object that this game is using</param> public void Update(Game1 game) { GameInput currentInputState = GameInput.GetState(); if (currentInputState.UpButton == ButtonState.Pressed) { if (speed <= 150) speed += 1f; else if (speed > 150) speed += .5f; } else speed -= 1; speed = (int)(MathHelper.Clamp((speed), 0f, 200)); rotation = MathHelper.ToRadians(680) /500 * speed - MathHelper.ToRadians(135); }