forked from s474139/Inteligentny_Wozek
regal can store packages
This commit is contained in:
parent
c3f3eea40e
commit
4a83094fb8
14
regal.py
14
regal.py
@ -18,8 +18,9 @@ def obliczPixeleDlugosciRegalu(self): #Przeliczanie dlugości regału podanego
|
|||||||
i = i + 1
|
i = i + 1
|
||||||
return dlugoscRegalu
|
return dlugoscRegalu
|
||||||
|
|
||||||
class Regal:
|
class Regal(pygame.sprite.Sprite):
|
||||||
def __init__(self, numerRegalu, dlugoscRegaluWKratkach, numerWiersza, numerKolumny):
|
def __init__(self, numerRegalu, dlugoscRegaluWKratkach, numerWiersza, numerKolumny):
|
||||||
|
super().__init__()
|
||||||
from ekran import screen
|
from ekran import screen
|
||||||
self.numerRegalu = numerRegalu
|
self.numerRegalu = numerRegalu
|
||||||
self.wysokoscRegalu = 64
|
self.wysokoscRegalu = 64
|
||||||
@ -30,26 +31,33 @@ class Regal:
|
|||||||
self.kolumna = obliczPixeleNaPodstawieKratek(numerKolumny)
|
self.kolumna = obliczPixeleNaPodstawieKratek(numerKolumny)
|
||||||
self.dlugosc = obliczPixeleDlugosciRegalu(self)
|
self.dlugosc = obliczPixeleDlugosciRegalu(self)
|
||||||
|
|
||||||
# from main import screen
|
package_storage = []
|
||||||
# from ekran import screen
|
shelfs = { # here packages are stored
|
||||||
|
"dolna": package_storage,
|
||||||
|
"gorna": package_storage
|
||||||
|
}
|
||||||
|
|
||||||
if(self.numerRegalu >= 0 and self.numerRegalu <= 4):
|
if(self.numerRegalu >= 0 and self.numerRegalu <= 4):
|
||||||
reg = pygame.Surface([self.dlugosc, self.wysokoscRegalu])
|
reg = pygame.Surface([self.dlugosc, self.wysokoscRegalu])
|
||||||
reg = pygame.image.load("images/regal.png")
|
reg = pygame.image.load("images/regal.png")
|
||||||
|
self.rect = reg.get_rect()
|
||||||
screen.blit(reg, (self.wiersz, self.kolumna))
|
screen.blit(reg, (self.wiersz, self.kolumna))
|
||||||
|
|
||||||
if(self.numerRegalu >= 5 and self.numerRegalu <= 8):
|
if(self.numerRegalu >= 5 and self.numerRegalu <= 8):
|
||||||
reg = pygame.Surface([self.dlugosc, self.wysokoscRegalu])
|
reg = pygame.Surface([self.dlugosc, self.wysokoscRegalu])
|
||||||
reg = pygame.image.load("images/regal1.png")
|
reg = pygame.image.load("images/regal1.png")
|
||||||
|
self.rect = reg.get_rect()
|
||||||
screen.blit(reg, (self.wiersz, self.kolumna))
|
screen.blit(reg, (self.wiersz, self.kolumna))
|
||||||
|
|
||||||
if(self.numerRegalu >= 9 and self.numerRegalu <= 12):
|
if(self.numerRegalu >= 9 and self.numerRegalu <= 12):
|
||||||
reg = pygame.Surface([self.dlugosc, self.wysokoscRegalu])
|
reg = pygame.Surface([self.dlugosc, self.wysokoscRegalu])
|
||||||
reg = pygame.image.load("images/regal2.png")
|
reg = pygame.image.load("images/regal2.png")
|
||||||
|
self.rect = reg.get_rect()
|
||||||
screen.blit(reg, (self.wiersz, self.kolumna))
|
screen.blit(reg, (self.wiersz, self.kolumna))
|
||||||
|
|
||||||
if(self.numerRegalu >= 13 and self.numerRegalu <= 16):
|
if(self.numerRegalu >= 13 and self.numerRegalu <= 16):
|
||||||
reg = pygame.Surface([self.dlugosc, self.wysokoscRegalu])
|
reg = pygame.Surface([self.dlugosc, self.wysokoscRegalu])
|
||||||
reg = pygame.image.load("images/regal3.png")
|
reg = pygame.image.load("images/regal3.png")
|
||||||
|
self.rect = reg.get_rect()
|
||||||
screen.blit(reg, (self.wiersz, self.kolumna))
|
screen.blit(reg, (self.wiersz, self.kolumna))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user