Ninja-Jump-and-run/scripts/utils.py
2026-03-04 16:50:44 +01:00

13 lines
361 B
Python

import pygame
import os
BASE_IMG_PATH = 'data/images/'
def load_image(path):
img = pygame.image.load(BASE_IMG_PATH + path).convert()
img.set_colorkey((0, 0, 0))
return img
def load_images(path):
images = []
for img_name in sorted(os.listdir(BASE_IMG_PATH + path)):
images.append(load_image(path + '/' + img_name))
return images