Ninja-Jump-and-run/scripts/utils.py

14 lines
361 B
Python
Raw Normal View History

2026-02-06 17:51:57 +00:00
import pygame
import os
BASE_IMG_PATH = 'data/images/'
def load_image(path):
2026-03-04 15:50:44 +00:00
img = pygame.image.load(BASE_IMG_PATH + path).convert()
img.set_colorkey((0, 0, 0))
return img
2026-02-06 17:51:57 +00:00
def load_images(path):
images = []
2026-03-04 15:50:44 +00:00
for img_name in sorted(os.listdir(BASE_IMG_PATH + path)):
images.append(load_image(path + '/' + img_name))
2026-02-06 17:51:57 +00:00
return images