Untitled
Anonymous
plain_text
05/15/2026 4:47 PM
936 B
9
Indexable
import pygame
#classe ausiliare
class Image(pygame.sprite.Sprite):
def __init__(self, path):
super().__init__
self.image = pygame.image.load(path)
#classe base
class Element():
def __init__(self, type):
#indicazione dell'indumento
self.chosen = 0
#lista di immagini
self.image_list = []
for i in range(1, 4):
path = f'images/{type}{i}.png'
loaded_image = Image(path)
self.image_list.append(loaded_image)
def choose_next(self):
self.chosen += 1
if self.chosen > 2:
self.chosen = 0
def chosen_image(self):
return self.image_list[self.chosen].image
Editor is loading...
Leave a Comment