From e5d6b894bcc5832baca245c00c75dbac408d77bf Mon Sep 17 00:00:00 2001 From: s464917 Date: Mon, 16 May 2022 21:41:38 +0200 Subject: [PATCH] dodane ikony dywanu i kaluzy, zmieniona ikona wozka --- enumy_i_slowniki.py | 4 ++-- krata.py | 15 ++++++++++++--- main.py | 2 +- stale.py | 4 ++++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/enumy_i_slowniki.py b/enumy_i_slowniki.py index cf1b5fa..42e2a8c 100644 --- a/enumy_i_slowniki.py +++ b/enumy_i_slowniki.py @@ -44,8 +44,8 @@ ZawartoscPolaNaKolorPola = { ZawartoscPola.PUSTE: BIALY, ZawartoscPola.SCIANA: CIEMNY_BRAZOWY1, ZawartoscPola.CEL: ZIELONY1, - ZawartoscPola.DYWAN: ZOLTY1, - ZawartoscPola.KALUZA: NIEBIESKI1, + ZawartoscPola.DYWAN: DYWAN, + ZawartoscPola.KALUZA: KALUZA, ZawartoscPola.SCIANA2: SZARY1, ZawartoscPola.OSOBA: IKONA } diff --git a/krata.py b/krata.py index 0e7fdcb..80200bf 100644 --- a/krata.py +++ b/krata.py @@ -71,12 +71,21 @@ class Krata(Obserwowany): start = (self.odstepMiedzyPolami + self.bokPola) * kolumna + self.odstepMiedzyPolami gora = (self.odstepMiedzyPolami + self.bokPola) * wiersz + self.odstepMiedzyPolami kolor_pola = ZawartoscPolaNaKolorPola[self.krata[wiersz][kolumna]] - if kolor_pola != IKONA: - pygame.draw.rect(self.okno, kolor_pola, [start, gora, self.bokPola, self.bokPola]) - else: + if kolor_pola == IKONA: osoba_ikona = pygame.transform.scale(pygame.image.load(os.path.join('Ikony', 'osoba2.png')), (BOK_AGENTA1, BOK_AGENTA1)) self.okno.blit(osoba_ikona, [start, gora, self.bokPola, self.bokPola]) + elif kolor_pola == KALUZA: + osoba_ikona = pygame.transform.scale(pygame.image.load(os.path.join('Ikony', 'kaluza.png')), + (BOK_AGENTA1, BOK_AGENTA1)) + self.okno.blit(osoba_ikona, [start, gora, self.bokPola, self.bokPola]) + elif kolor_pola == DYWAN: + osoba_ikona = pygame.transform.scale(pygame.image.load(os.path.join('Ikony', 'dywan.png')), + (BOK_AGENTA1, BOK_AGENTA1)) + self.okno.blit(osoba_ikona, [start, gora, self.bokPola, self.bokPola]) + + else: + pygame.draw.rect(self.okno, kolor_pola, [start, gora, self.bokPola, self.bokPola]) def narysujKrateAlternatywnie(self): self.okno.fill(SZARY1) diff --git a/main.py b/main.py index e509a23..926ecb2 100644 --- a/main.py +++ b/main.py @@ -23,7 +23,7 @@ def dodaj_agenta(): # random.randint(0, LICZBA_POL_W_POZIOMIE - BOK_AGENTA1_W_POLACH)) # pole_lewe_gorne = PoleKraty(krata_magazynu, LICZBA_POL_W_PIONIE - BOK_AGENTA1_W_POLACH, int(LICZBA_POL_W_POZIOMIE / 2)) pole_lewe_gorne = PoleKraty(krata_magazynu, 0, 0) - pom = 'test2_ikona.png' + pom = 'wozek_widlowy.png' ikona = pygame.transform.scale(pygame.image.load(os.path.join('Ikony', pom)), (BOK_AGENTA1, BOK_AGENTA1)) Agent(krata_magazynu, pole_lewe_gorne, ikona) diff --git a/stale.py b/stale.py index 95c578e..5398428 100644 --- a/stale.py +++ b/stale.py @@ -28,6 +28,10 @@ ZOLTY1 = (231, 213, 69) NIEBIESKI1 = (65, 125, 225) IKONA=pygame.transform.scale(pygame.image.load(os.path.join('Ikony', 'osoba2.png')), (BOK_AGENTA1, BOK_AGENTA1)) +KALUZA=pygame.transform.scale(pygame.image.load(os.path.join('Ikony', 'kaluza.png')), + (BOK_AGENTA1, BOK_AGENTA1)) +DYWAN=pygame.transform.scale(pygame.image.load(os.path.join('Ikony', 'dywan.png')), + (BOK_AGENTA1, BOK_AGENTA1)) ### ###