Ninja-Jump-and-run/scripts/utils.py
binaerverkehr 4449656a69 refactor: Typisierung in Hauptdateien und Skripten ergaenzt
- Felder und Methoden in Game und Editor typisiert
- Tilemap: Felder, render, tiles_around, physics_rects_around, autotile
- Animation: Konstruktor-Parameter, Felder, copy und update
- Clouds: Cloud und Clouds vollstaendig typisiert
- utils: load_image und load_images mit Rueckgabe-Typ
2026-05-11 10:37:37 +02:00

17 lines
444 B
Python

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