from os import walk import pygame def import_folder(path): surface_list = [] #print(f"Attempting to load images from: {path}") # Debugging for _, __, img_files in walk(path): if not img_files: print(f"No images found in {path}") # Debugging for image in img_files: full_path = path + '/' + image #print(f"Loading image: {full_path}") # Debugging try: image_surface = pygame.image.load(full_path).convert_alpha() surface_list.append(image_surface) except pygame.error as e: print(f"Error loading {full_path}: {e}") # If an image is missing or corrupted #print(f"Loaded {len(surface_list)} images from {path}\n") # Debugging return surface_list