dodanie informacji o pozostalych smieciach

This commit is contained in:
s444349 2020-04-06 18:16:38 +02:00
parent 863c124adb
commit e43c07446a
415 changed files with 50 additions and 9 deletions

55
game.py
View File

@ -5,6 +5,8 @@ import random
import os
import shutil
pygame.init()
# kolory
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
@ -25,7 +27,7 @@ ILOSC_WIERSZY = 15
ILOSC_KOLUMN = 15
# rozmiar okna
WINDOW_SIZE = [980, 980]
WINDOW_SIZE = [1300, 980]
# Tworzenie planszy i kratek
plansza = np.array([[modele.Kratka(i, j) for i in range(ILOSC_KOLUMN)] for j in range(ILOSC_WIERSZY)])
@ -83,6 +85,37 @@ smieci_lista = [os.path.join(path, filename)
for path, dirs, files in os.walk("resources/smieci")
for filename in files]
# informacje o ilosci smieci w domach
font = pygame.font.SysFont("arial", 20, bold = True)
text_pozostalo = font.render("Pozostało śmieci w domach:", True, WHITE)
def liczSmieci(domy):
ile_metalu = 0
ile_szkla = 0
ile_papieru = 0
ile_plastiku = 0
ile_pozostalych = 0
for d in domy:
for s in d.smieci:
if "metal" in s:
ile_metalu += 1
elif "paper" in s:
ile_papieru += 1
elif "plastic" in s:
ile_plastiku += 1
elif "glass" in s:
ile_szkla += 1
elif "trash" in s:
ile_pozostalych += 1
text_metal = font.render("Metal: " + str(ile_metalu), True, WHITE)
text_papier = font.render("Papier: " + str(ile_papieru), True, WHITE)
text_plastik = font.render("Plastik: " + str(ile_plastiku), True, WHITE)
text_szklo = font.render("Szkło: " + str(ile_szkla), True, WHITE)
text_pozostale = font.render("Pozostałe: " + str(ile_pozostalych), True, WHITE)
return text_metal, text_papier, text_plastik, text_szklo, text_pozostale;
for i in range(len(wspolrzedne_domow)):
dom = modele.Dom(wspolrzedne_domow[i][0], wspolrzedne_domow[i][1])
dom.setImage(pygame.image.load(random.choice(doms_array)))
@ -91,15 +124,17 @@ for i in range(len(wspolrzedne_domow)):
domy_lista.add(dom)
all_sprites_list.add(dom)
for d in domy_lista.sprites():
lista_domow = domy_lista.sprites()
for d in lista_domow:
for j in range(5):
smiec = random.choice(smieci_lista)
d.dodajSmiec(smiec)
smieci_lista.remove(smiec)
########## TEST DODAWANIA SMIECI Z POJEDYNCZEGO DOMU DO FOLDERU KONTENERA ZE SZKLEM
# for u in domy_lista.sprites()[0].smieci:
# kontener_szklo.dodajSmiec(u)
# for d in lista_domow:
# for s in d.smieci:
# kontener_szklo.dodajSmiec(s)
# ustawienie wysypiska, rozmiar wysypiska 5x5
for i in range(5):
@ -111,8 +146,6 @@ all_sprites_list.add(kontener_plastik, kontener_metal, kontener_organiczne, kont
def game():
pygame.init()
obraz = pygame.display.set_mode(WINDOW_SIZE)
# Tytul okienka
@ -139,7 +172,6 @@ def game():
print("Click ", pozycja_myszki,
"Grid coordinates: ", wiersz, kolumna)
# plansza[wiersz, kolumna].setKolor(BLUE)
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
@ -179,5 +211,14 @@ def game():
all_sprites_list.draw(obraz)
smieciarka.rand_move()
text_metal, text_papier, text_plastik, text_szklo, text_pozostale = liczSmieci(lista_domow)
obraz.blit(text_pozostalo,
(1020, 240))
obraz.blit(text_metal, (1020, 280))
obraz.blit(text_plastik, (1020, 320))
obraz.blit(text_szklo, (1020, 360))
obraz.blit(text_papier, (1020, 400))
obraz.blit(text_pozostale, (1020, 440))
pygame.display.flip()
pygame.quit()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Some files were not shown because too many files have changed in this diff Show More