# Main loop exit = False lost_game = False alert = 30 while not exit: # Process pygame events for event in pygame.event.get(): # Escape key to quit the game if event.type == pygame.QUIT or \ (event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE): exit = True break robot.input(event) if exit: break current_time = time.time() if current_time - start_time <= frame_time: continue start_time = current_time if lost_game == False: # If enough time passed generate a new object if last_person_tick == 0: last_person_tick = person_generation_ticks people.append(Person( window_w, window_h, unit, person_speed)) else: last_person_tick -= 1