Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- # auxiliary class
- class Image(pygame.sprite.Sprite):
- def __init__(self, path):
- super().__init__()
- self.image = pygame.image.load(path)
- # base class
- class Element():
- def __init__(self, type):
- # chosen clothing indicator
- self.chosen = 0
- # image list
- self.image_list = []
- # using a loop in order to load in every image from the directory
- 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
- class HeadCover(Element):
- def __init__(self):
- super().__init__('head')
Add Comment
Please, Sign In to add comment