# Region Input touch screen movement // <summary> // input helper method provided by gamescreen. packages up the various input values for versions of use. /// here it checks for pausing and handles controlling the player's tank. here, it checks to pause and handle the tanks that control players. /// </Summary> /// <Param name = "input"> Status of the game handle </param> /// this method reads the current player input and public override void handleinput (inputstate input) will be used to respond to game variable changes in the future) {If (input = NULL) // throw a new path and name it input; throw new argumentexception ("input"); // checks whether the game status is paused if (input. pausegame) {If (gameover = true) finishcurrentgame ();} else {// obtain the touch panel status touchstate = touchpanel. getstate (); // set a bool to define whether to touch the touch part bool buttontouched = fa LSE; // cyclically traverse the status of each touch panel foreach (touchlocation location in touchstate) {Switch (location. state) {// press case touchlocationstate. pressed: buttontouched = true; break; // move case touchlocationstate. moved: break; // release case touchlocationstate. released: break;} // A is defined as a float type. The F after 0.0f indicates a float constant. If no F is available, 0.0 indicates a double float Movement = 0.0f; If (accelstate! = NULL) {If (math. ABS (accelstate. x)> 0.0f) {If (accelstate. x> 0.0f) Movement = 1.0f; else Movement =-1.0f ;}// obtain the keyboardstate keystate = keyboard. getstate (); // The updated player speed is greater than the X axis #1 player. velocity. X = movement; // control the game based on the input characters of the keyboard // This part handles tank movements. We only allow one "motion" operation to happen once, so that the touchpad device cannot obtain a dual blow if (input. currentgamepadstates [0]. DPAD. left = buttonstate. pressed | keystate. iskeydown (keys. left) {// The updated player speed is greater than the X axis #2 player. velocity. X =-1.0f;} else if (input. currentgamepadstates [0]. DPAD. right = buttonstate. pressed | keystate. iskeydown (keys. right) {// The updated player speed is greater than the X axis #3 player. velocity. X = 1.0f;} else {// The updated player speed is greater than the X axis #4 player. velocity. X = mathhelper. mi N (input. currentgamepadstates [0]. thumbsticks. Left. x * 2.0f, 1.0f) ;}// B button, or press the upper half pad or space on the keyboard or touch the touch screen for fire weapons. If (input. currentgamepadstates [0]. isbuttondown (buttons. b) | input. currentgamepadstates [0]. isbuttondown (buttons. a) | input. currentgamepadstates [0]. thumbsticks. left. y> 0.25f | keystate. iskeydown (keys. space) | buttontouched) {If (player. firetimer <= 0.0f & player. isalive &&! Gameover) {bullet = creteplayerbullet (); bullet. position = new vector2 (INT) (player. position. X + player. width/2)-bullettexture. width/2, player. position. y-4); bullet. velocity = new vector2 (0,-256.0f); player. firetimer = 1.0f; particle. createplayerfiresmoke (player); playerfired. play ();} else if (gameover) finishcurrentgame () ;}} base. handleinput (input);} Public Virtual void handleinput (inputstate input ){}