View difference between Paste ID: py3yfssV and Aha4C01z
SHOW: | | - or go back to the newest paste.
1
import pygame
2
3
# auxiliary class
4
5
6
class Image(pygame.sprite.Sprite):
7
    def __init__(self, path):
8-
        super(Image, self).__init__()
8+
        super().__init__()
9
        self.image = pygame.image.load(path)
10
11
# base class
12
13
14
class Element():
15
    def __init__(self, type):
16
        # chosen clothing indicator
17
        self.chosen = 0
18
        # image list
19
        self.image_list = []
20
        # using a loop in order to load in every image from the directory
21
        for i in range(1, 4):
22
            path = f'images/{type}{i}.png'
23
            loaded_image = Image(path)
24
            self.image_list.append(loaded_image)
25
26
    def choose_next(self):
27
        self.chosen += 1
28
        if self.chosen > 2:
29
            self.chosen = 0
30
31
    def chosen_image(self):
32
        return self.image_list[self.chosen].image
33
34
35
class HeadCover(Element):
36
    def __init__(self):
37
        super().__init__('head')
38