проверь код: import random # Define the game variables score = 0 level = 1 # Define the game screen screen = pygame.display.set_mode((640, 480)) pygame.display.set_caption("Flappy NAME_1") # Define the player object player = pygame.image.load("player.png") player_rect = player.get_rect(center=(320, 240)) # Define the obstacle object obstacle = pygame.image.load("obstacle.png") obstacle_rect = obstacle.get_rect(center=(320, 360)) # Define the score text object score_text = pygame.text.Text(score, font=pygame.font.SysFont("Arial", 30), (320, 240)) # Define the level text object level_text = pygame.text.Text(level, font=pygame.font.SysFont("Arial", 30), (320, 360)) # Initialize the pygame clock clock = pygame.time.Clock() # Game loop while True: # Update the player position player_rect.center = (player_rect.center[0] + 10, player_rect.center[1]) # Check if the player collides with the obstacle if player_rect.collidable(obstacle_rect): score -= 1 player_rect.x = random.randint(320, 640) player_rect.y = random.randint(240, 480) # Update the score text score_text.center = (320, 240) score_text.text = str(score) # Update the level text level_text.center = (320, 360) level_text.text = str(level) # Update the screen pygame.display.update() # Handle the quit event for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() quit() # Handle the game over event if score <= 0: pygame.quit() quit() # Clean up pygame.quit() quit() You should write your response with 100 or more words.
user