utils.py
unknown
python
a year ago
539 B
2
Indexable
import os import pygame BASE_IMG_PATH = 'data/images/' def load_image(path, playert=False): if playert: img = pygame.image.load(BASE_IMG_PATH + path).convert() img.set_colorkey((0, 0, 0)) return pygame.transform.scale(img, (16, 16)) else: return pygame.image.load(BASE_IMG_PATH + path) def load_images(path, scale_factor=1): images = [] for img_name in sorted(os.listdir(BASE_IMG_PATH + path)): images.append(load_image(path + '/' + img_name)) return images
Editor is loading...
Leave a Comment