def game_loop(screen: pygame.Surface, cell_size: tuple, game_logic: GameLogic): """ cell_size : Invidiual cell size (cell_width,cell_height) """ small_font, medium_font, large_font = get_font( resource_path("assets/fonts/OpenSans-Regular.ttf")) angel_icon = pygame.image.load( resource_path("assets/images/angel.png")).convert() angel_icon = pygame.transform.scale(angel_icon, cell_size) devil_icon = pygame.image.load( resource_path("assets/images/devil.jpg")).convert() devil_icon = pygame.transform.scale(devil_icon, cell_size) is_instruction = True is_ignore_instruction = False while True: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() screen.fill(BLACK) if game_logic.is_game_over(): show_game_over_screen(screen, medium_font, game_logic) if event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN: break elif is_instruction and not is_ignore_instruction: show_instruction_screen(screen, medium_font, game_logic) if event.type == pygame.KEYDOWN: if event.key == pygame.K_RETURN: is_instruction = False elif event.key == pygame.K_i: is_ignore_instruction = True else: game_logic, move_made = show_playing_screen( screen, cell_size, angel_icon, devil_icon, game_logic) is_instruction = move_made pygame.display.flip()