Time for action – handling input
Add the following declarations to the declarations region of the Player class:
private static Vector2 baseAngle = Vector2.Zero; private static Vector2 turretAngle = Vector2.Zero; private static float playerSpeed = 90f;
Add the methods to handle keyboard and gamepad input to the Player class:
#region Input Handling private static Vector2 handleKeyboardMovement(KeyboardState keyState) { Vector2 keyMovement = Vector2.Zero; if (keyState.IsKeyDown(Keys.W)) keyMovement.Y--; if (keyState.IsKeyDown(Keys.A)) keyMovement.X--; if (keyState.IsKeyDown(Keys.S)) keyMovement.Y++; if (keyState.IsKeyDown(Keys.D)) keyMovement.X++; return keyMovement; } private static Vector2 handleGamePadMovement(GamePadState gamepadState) { return new Vector2( gamepadState.ThumbSticks.Left.X, -gamepadState.ThumbSticks.Left.Y); } private static Vector2 handleKeyboardShots(KeyboardState keyState) { Vector2 keyShots...