py_yugi_clone/scripts/utils.py

22 lines
500 B
Python
Raw Normal View History

2024-07-10 20:08:18 +02:00
import pygame
import os
TILE_DICT = {
1 : ('grass',0),
2 : ('stone',0),
3 : ('grass',1),
4 : ('stone',1),
5 : ('grass',2),
6 : ('stone',2)
}
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