original_docstring: Takes in the current ball x and y speed and mode. The ball speed is set to zero and arguments are taken and saved. If the mode is pause then it will pause the screen and create a play button if the mode is game_over or anything else it will create a redo button to play again. Returns True if the user hits the home button
docstring: Takes in the current ball x and y speed and mode. The ball speed is set to zero and arguments are taken and saved. If the mode is pause then it will pause the screen and create a play button if the mode is game_over or anything else it will create a redo button to play again. Returns True if the user hits the home button
docstring_tokens: Takes in the current ball x and y speed and mode . The ball speed is set to zero and arguments are taken and saved . If the mode is pause then it will pause the screen and create a play button if the mode is game_over or anything else it will create a redo button to play again . Returns True if the user hits the home button
code: def pause_screen(self, ball_x_speed, ball_y_speed, mode):
          """Takes in the current ball x and y speed and mode. The ball speed is set to zero and arguments are taken and saved. If the mode is pause then it will pause the screen and create a play button if the mode is game_over or anything else it will create a redo button to play again. Returns True if the user hits the home button"""
          running = True
  
          while running:
              self.click = False
              # Checks to see if the user quits or presses the mouse. If they press the mouse down then it will return click as True
              for event in pygame.event.get():
                  if event.type == pygame.QUIT:
                      pygame.quit()
                  if event.type == pygame.MOUSEBUTTONDOWN:
                      if event.button == 1:
                          self.click = True
              # Set the modes if pause creates a pause button. Else/Game over creates a redo/play again button.
              if mode == "pause":
                  play_button = pygame.rect.Rect((300, 250, 50, 50))
                  pygame.draw.rect(self.screen, (0, 255, 0), play_button)
                  pygame.draw.polygon(self.screen, (255, 255, 255), ((315, 260), (315, 290), (340, 275)))
                  self.display.create_text((290, 310), (255, 255, 255), 32, "Play", self.screen)
              else:
                  play_button = pygame.rect.Rect((300, 250, 50, 50))
                  pygame.draw.rect(self.screen, (0, 255, 0), play_button)
                  self.screen.blit(self.reload, (301, 250))
                  self.display.create_text((238, 200), (255, 255, 255), 50, "GAME  OVER", self.screen)
                  self.display.create_text((250, 310), (255, 255, 255), 32, "Play Again", self.screen)
  
              # Home button
              home_button = pygame.rect.Rect((460, 250, 50, 50))
              pygame.draw.rect(self.screen, (0, 0, 255), home_button)
              pygame.draw.polygon(self.screen, (255, 255, 255), ((465, 270), (505, 270), (485, 255)))
              pygame.draw.rect(self.screen, (255, 255, 255), (465, 270, 15, 20))
              pygame.draw.rect(self.screen, (255, 255, 255), (491, 270, 15, 20))
              pygame.draw.rect(self.screen, (255, 255, 255), (465, 270, 40, 7.5))
              self.display.create_text((445, 310), (255, 255, 255), 32, "Home", self.screen)
  
              # Set the ball speed to zero. If teh user hits the play button/redo button then the game will resume. by quiting the look
              self.ball.ball_x_speed = 0
              self.ball.ball_y_speed = 0
              self.y_speed = 0
              if play_button.collidepoint((get_mouse_pos())):
                  if self.click:
                      print("clicked play button")
                      self.ball.ball_x_speed = ball_x_speed
                      self.ball.ball_y_speed = ball_y_speed
                      self.y_speed = 8
                      running = False
              # If the user hits the home button then will return True and go back to the Start Menu
              if home_button.collidepoint((get_mouse_pos())):
                  if self.click:
                      print("Clicked Home button")
                      self.ball.ball_x_speed = ball_x_speed
                      self.ball.ball_y_speed = ball_y_speed
                      self.y_speed = 8
                      return True
              pygame.display.update()
          return
code_tokens: def pause_screen ( self , ball_x_speed , ball_y_speed , mode ) : running = True while running : self . click = False for event in pygame . event . get ( ) : if event . type == pygame . QUIT : pygame . quit ( ) if event . type == pygame . MOUSEBUTTONDOWN : if event . button == 1 : self . click = True if mode == "pause" : play_button = pygame . rect . Rect ( ( 300 , 250 , 50 , 50 ) ) pygame . draw . rect ( self . screen , ( 0 , 255 , 0 ) , play_button ) pygame . draw . polygon ( self . screen , ( 255 , 255 , 255 ) , ( ( 315 , 260 ) , ( 315 , 290 ) , ( 340 , 275 ) ) ) self . display . create_text ( ( 290 , 310 ) , ( 255 , 255 , 255 ) , 32 , "Play" , self . screen ) else : play_button = pygame . rect . Rect ( ( 300 , 250 , 50 , 50 ) ) pygame . draw . rect ( self . screen , ( 0 , 255 , 0 ) , play_button ) self . screen . blit ( self . reload , ( 301 , 250 ) ) self . display . create_text ( ( 238 , 200 ) , ( 255 , 255 , 255 ) , 50 , "GAME  OVER" , self . screen ) self . display . create_text ( ( 250 , 310 ) , ( 255 , 255 , 255 ) , 32 , "Play Again" , self . screen ) home_button = pygame . rect . Rect ( ( 460 , 250 , 50 , 50 ) ) pygame . draw . rect ( self . screen , ( 0 , 0 , 255 ) , home_button ) pygame . draw . polygon ( self . screen , ( 255 , 255 , 255 ) , ( ( 465 , 270 ) , ( 505 , 270 ) , ( 485 , 255 ) ) ) pygame . draw . rect ( self . screen , ( 255 , 255 , 255 ) , ( 465 , 270 , 15 , 20 ) ) pygame . draw . rect ( self . screen , ( 255 , 255 , 255 ) , ( 491 , 270 , 15 , 20 ) ) pygame . draw . rect ( self . screen , ( 255 , 255 , 255 ) , ( 465 , 270 , 40 , 7.5 ) ) self . display . create_text ( ( 445 , 310 ) , ( 255 , 255 , 255 ) , 32 , "Home" , self . screen ) self . ball . ball_x_speed = 0 self . ball . ball_y_speed = 0 self . y_speed = 0 if play_button . collidepoint ( ( get_mouse_pos ( ) ) ) : if self . click : print ( "clicked play button" ) self . ball . ball_x_speed = ball_x_speed self . ball . ball_y_speed = ball_y_speed self . y_speed = 8 running = False if home_button . collidepoint ( ( get_mouse_pos ( ) ) ) : if self . click : print ( "Clicked Home button" ) self . ball . ball_x_speed = ball_x_speed self . ball . ball_y_speed = ball_y_speed self . y_speed = 8 return True pygame . display . update ( ) return
short_docstring: Takes in the current ball x and y speed and mode.
short_docstring_tokens: Takes in the current ball x and y speed and mode .
comment: """Takes in the current ball x and y speed and mode. The ball speed is set to zero and arguments are taken and saved. If the mode is pause then it will pause the screen and create a play button if the mode is game_over or anything else it will create a redo button to play again. Returns True if the user hits the home button"""$SEP$# Checks to see if the user quits or presses the mouse. If they press the mouse down then it will return click as True
  $SEP$# Set the modes if pause creates a pause button. Else/Game over creates a redo/play again button.
  $SEP$# Home button
  $SEP$# Set the ball speed to zero. If teh user hits the play button/redo button then the game will resume. by quiting the look
  $SEP$# If the user hits the home button then will return True and go back to the Start Menu
  