Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.9 kB
2
Indexable
Never
class Egg:
    def __init__(self):
        self.number = random.randint(0, 16)
        if self.number == 1:
            self.image = pygame.image.load("jajko1.png")
        elif self.number == 2:
            self.image = pygame.image.load("jajko2.png")
        elif self.number == 3:
            self.image = pygame.image.load("jajko3.png")
        elif self.number == 4:
            self.image = pygame.image.load("jajko4.png")
        elif self.number == 5:
            self.image = pygame.image.load("jajko5.png")
        elif self.number == 6:
            self.image = pygame.image.load("jajko6.png")
        elif self.number == 7:
            self.image = pygame.image.load("jajko7.png")
        elif self.number == 8:
            self.image = pygame.image.load("jajko8.png")
        elif self.number == 9:
            self.image = pygame.image.load("jajko9.png")
        elif self.number == 10:
            self.image = pygame.image.load("jajko10.png")
        elif self.number == 11:
            self.image = pygame.image.load("jajko11.png")
        elif self.number == 12:
            self.image = pygame.image.load("jajko12.png")
        elif self.number == 13:
            self.image = pygame.image.load("jajko13.png")
        elif self.number == 14:
            self.image = pygame.image.load("jajko14.png")
        elif self.number == 15:
            self.image = pygame.image.load("jajko15.png")
        else:
            self.image = pygame.image.load("jajko16.png")
        self.rectangle = self.image.get_rect()
        self.rectangle.x = random.randint(0, width-50)
        self.rectangle.y = random.randint(0, height-50)
    def jajkos(self):
        if self.number %2 ==0:
            self.image = pygame.image.load("jajko1.png")
        else:
            self.image= pygame.image.load("jajko2.png")
    def draw(self, screen):
        screen.blit(self.image, self.rectangle)