move the ship to the rightgame_ functions py def check_events(ship)"""respond to keypresses and mouse events ""for event in pygame event get()if event type =pygame quitsys exit( elif event type =pygame keydownif event key =pygame k_rightmove the ship to the right ship rect centerx + we give the check_events(function ship parameterbecause the ship needs to move to the right when the right arrow key is pressed inside check_events(we add an elif block to the event loop to respond when pygame detects keydown event we check if the key pressed is the right arrow key (pygame k_rightby reading the event key attribute if the right arrow key was pressedwe move the ship to the right by increasing the value of ship rect centerx by we need to update the call to check_events(in alien_invasion py so it passes ship as an argumentalien_ invasion py start the main loop for the game while truegf check_events(shipgf update_screen(ai_settingsscreenshipif you run alien_invasion py nowyou should see the ship move to the right one pixel every time you press the right arrow key that' startbut it' not an efficient way to control the ship let' improve this control by allowing continuous movement allowing continuous movement when the player holds down the right arrow keywe want the ship to continue moving right until the player releases the key we'll have our game detect pygame keyup event so we'll know when the right arrow key is releasedthen we'll use the keydown and keyup events together with flag called moving_right to implement continuous motion when the ship is motionlessthe moving_right flag will be false when the right arrow key is pressedwe'll set the flag to trueand when it' releasedwe'll set the flag to false again the ship class controls all attributes of the shipso we'll give it an attribute called moving_right and an update(method to check the status of the moving_right flag the update(method will change the position of the ship if the flag is set to true we'll call this method any time we want to update the position of the ship