public void update(GameTime gameTime, GraphicsDevice graphics, SpriteBatch spriteBatch) { //player_level_collision(); player.update(gameTime, spriteBatch); asteroid.update(graphics, gameTime); camera_updates(); spawn += (float)gameTime.ElapsedGameTime.TotalSeconds; foreach (Enemy enemy in enemies) { enemy.Update(graphics, gameTime); if (enemy.isEnemyDead() == true) { score += 7; enemy.dead = false; } } load_enemies(solar_systems[0].system_center); particle_manager.update(gameTime); spawn_motherships(gameTime, solar_systems[0].system_center); for (int i = 0; i < mother_ships.Count; i++) { mother_ships[i].Update(graphics, gameTime); } keyboard = Keyboard.GetState(); if (keyboard.IsKeyDown(Keys.R)) { apply_screen_shake(); } map.update(gameTime, player.get_base_position()); //If hit apply shake if (Constant.shake) { apply_screen_shake(); Constant.shake = false; } Vector2 diff = player.position - past_player_position; starfield.update(gameTime, diff); past_player_position = player.position; for (int i = 0; i < solar_systems.Count; i++) { solar_systems[i].update(gameTime); } rogue.update(gameTime, player.position); if (rogue.dead == true) { addRougeScore(); rogue = new Rogue(new Vector2(0, 0), player); counter--; } }
public void update(GameTime gameTime) { elapsed += (float)gameTime.ElapsedGameTime.TotalSeconds; starfield.update(gameTime, new Vector2(1, -1)); rotation += 0.01f; if (rotation * (180 / Math.PI) >= 360) { rotation = 0; } btnStart = new Button(Constant.start_button, graphics); btnControls = new Button(Constant.controls_button, graphics); btnStart.setPosition(new Vector2(300, 150)); btnControls.setPosition(new Vector2(305, 250)); btnStart.Update(Mouse.GetState()); btnControls.Update(Mouse.GetState()); if (btnStart.isClicked || GamePad.GetState(PlayerIndex.One).Buttons.A == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Space) || Keyboard.GetState().IsKeyDown(Keys.Enter)) { if (menu_option == 0) { Game1.reset = true; Game1.current_game_state = Game1.GameState.Playing; } else if (menu_option == 1) { Game1.current_game_state = Game1.GameState.Controls; } } if (elapsed > 0.1) { if (Keyboard.GetState().IsKeyDown(Keys.S) || Keyboard.GetState().IsKeyDown(Keys.Down) || GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.Y < 0) { if (menu_option < 1) { menu_option++; selector_position.Y += 100f; } } else if (Keyboard.GetState().IsKeyDown(Keys.W) || Keyboard.GetState().IsKeyDown(Keys.Up) || GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.Y > 0) { if (menu_option > 0) { menu_option--; selector_position.Y -= 100f; } } elapsed = 0; } }
public void update(GameTime gameTime) { starfield.update(gameTime, new Vector2(1, -1)); rotation += 0.01f; if (rotation * (180 / Math.PI) >= 360) { rotation = 0; } if (GamePad.GetState(PlayerIndex.One).Buttons.B == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Back)) { Game1.current_game_state = Game1.GameState.MainMenu; } }
public void update(GameTime gameTime) { elapsed += (float)gameTime.ElapsedGameTime.TotalSeconds; starfield.update(gameTime, new Vector2(1, -1)); rotation += 0.01f; if (rotation * (180 / Math.PI) >= 360) { rotation = 0; } if (elapsed > 0.2) { if (Keyboard.GetState().IsKeyDown(Keys.B) || Keyboard.GetState().IsKeyDown(Keys.Back) || Keyboard.GetState().IsKeyDown(Keys.Enter) || GamePad.GetState(PlayerIndex.One).Buttons.B == ButtonState.Pressed) { Game1.current_game_state = Game1.GameState.MainMenu; } } }