ship py class ship()def __init__(selfscreen)--snip-start each new ship at the bottom center of the screen self rect centerx self screen_rect centerx self rect bottom self screen_rect bottom movement flag self moving_right false def update(self)"""update the ship' position based on the movement flag ""if self moving_rightself rect centerx + def blitme(self)--snip-we add self moving_right attribute in the __init__(method and set it to false initially then we add update()which moves the ship right if the flag is true now modify check_events(so that moving_right is set to true when the right arrow key is pressed and false when the key is releasedgame_ functions py def check_events(ship)"""respond to keypresses and mouse events ""for event in pygame event get()--snip-elif event type =pygame keydownif event key =pygame k_rightu ship moving_right true elif event type =pygame keyupif event key =pygame k_rightship moving_right false at uwe modify how the game responds when the player presses the right arrow keyinstead of changing the ship' position directlywe merely set moving_right to true at vwe add new elif blockwhich responds to keyup events when the player releases the right arrow key (k_right)we set moving_right to false finallywe modify the while loop in alien_invasion py so it calls the ship' update(method on each pass through the loopalien_ invasion py start the main loop for the game while truegf check_events(shipship update(gf update_screen(ai_settingsscreenshipa ship that fires bullets