starshipmeteors pygame break return result def _display_message(selfmessage)""displays message to the user on the screen ""text_font pygame font font('freesansbold ttf' text_surface text_font render(messagetruebluewhitetext_rectangle text_surface get_rect(text_rectangle center (display_width display_height self display_surface fill(whiteself display_surface blit(text_surfacetext_rectangledef _pause(self)paused true while pausedfor event in pygame event get()if event type =pygame keydownif event key =pygame k_ppaused false break def play(self)is_running true starship_collided false cycle_count main game playing loop while is_running and not starship_collidedindicates how many times the main game loop has been run cycle_count + see if the player has won if cycle_count =max_number_of_cyclesself _display_message('winner!'break work out what the user wants to do for event in pygame event get()if event type =pygame quitis_running false elif event type =pygame keydowncheck to see which key is pressed if event key =pygame k_rightright arrow key has been pressed move the player right self starship move_right(elif event key =pygame k_leftleft arrow has been pressed