From 4a83094fb8aac60b1efa1d9a85045bca857299ec Mon Sep 17 00:00:00 2001 From: Woj Date: Sun, 28 May 2023 00:02:24 +0200 Subject: [PATCH] regal can store packages --- regal.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/regal.py b/regal.py index 2074c10..71234f8 100644 --- a/regal.py +++ b/regal.py @@ -18,8 +18,9 @@ def obliczPixeleDlugosciRegalu(self): #Przeliczanie dlugości regału podanego i = i + 1 return dlugoscRegalu -class Regal: +class Regal(pygame.sprite.Sprite): def __init__(self, numerRegalu, dlugoscRegaluWKratkach, numerWiersza, numerKolumny): + super().__init__() from ekran import screen self.numerRegalu = numerRegalu self.wysokoscRegalu = 64 @@ -30,26 +31,33 @@ class Regal: self.kolumna = obliczPixeleNaPodstawieKratek(numerKolumny) self.dlugosc = obliczPixeleDlugosciRegalu(self) - # from main import screen - # from ekran import screen + package_storage = [] + shelfs = { # here packages are stored + "dolna": package_storage, + "gorna": package_storage + } if(self.numerRegalu >= 0 and self.numerRegalu <= 4): reg = pygame.Surface([self.dlugosc, self.wysokoscRegalu]) reg = pygame.image.load("images/regal.png") + self.rect = reg.get_rect() screen.blit(reg, (self.wiersz, self.kolumna)) if(self.numerRegalu >= 5 and self.numerRegalu <= 8): reg = pygame.Surface([self.dlugosc, self.wysokoscRegalu]) reg = pygame.image.load("images/regal1.png") + self.rect = reg.get_rect() screen.blit(reg, (self.wiersz, self.kolumna)) if(self.numerRegalu >= 9 and self.numerRegalu <= 12): reg = pygame.Surface([self.dlugosc, self.wysokoscRegalu]) reg = pygame.image.load("images/regal2.png") + self.rect = reg.get_rect() screen.blit(reg, (self.wiersz, self.kolumna)) if(self.numerRegalu >= 13 and self.numerRegalu <= 16): reg = pygame.Surface([self.dlugosc, self.wysokoscRegalu]) reg = pygame.image.load("images/regal3.png") + self.rect = reg.get_rect() screen.blit(reg, (self.wiersz, self.kolumna))