private void UpdatePlayer3(GameTime gameTime) { player3.Update(gameTime); // Use the Keyboard / Dpad if (currentKeyboardState.IsKeyDown(Keys.A)) { player3.Position.X -= playerMoveSpeed; } if (currentKeyboardState.IsKeyDown(Keys.D)) { player3.Position.X += playerMoveSpeed; } if (currentKeyboardState.IsKeyDown(Keys.W)) { player3.Position.Y -= playerMoveSpeed; } if (currentKeyboardState.IsKeyDown(Keys.S)) { player3.Position.Y += playerMoveSpeed; } // Fire only every interval we set as the fireTime if (gameTime.TotalGameTime - previousFireTime > fireTime) { // Reset our current time previousFireTime = gameTime.TotalGameTime; // Add the projectile, but add it to the front and center of the player AddProjectile(player3.Position + new Vector2(player3.Width / 2, 0)); // Play the laser sound laserSound.Play(); } // Make sure that the player does not go out of bounds player3.Position.X = MathHelper.Clamp(player3.Position.X, 0, GraphicsDevice.Viewport.Width - player3.Width); player3.Position.Y = MathHelper.Clamp(player3.Position.Y, 0, GraphicsDevice.Viewport.Height - player3.Height); if (player3.Health <= 0) { player3.Health = 200; score = 0; } }