From 863c124adbbcd5ffb3a65a1d0ccf298be77721e8 Mon Sep 17 00:00:00 2001 From: s444349 Date: Mon, 6 Apr 2020 17:13:01 +0200 Subject: [PATCH] poprawa komentarzy --- game.py | 26 ++++++++++---------------- modele.py | 6 ++---- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/game.py b/game.py index 6b15be0..f7680a6 100644 --- a/game.py +++ b/game.py @@ -1,6 +1,3 @@ -# TODO: okienko z informacjami - - import pygame import modele import numpy as np @@ -100,9 +97,9 @@ for d in domy_lista.sprites(): d.dodajSmiec(smiec) smieci_lista.remove(smiec) -########## TEST DODAWANIA SMIECI Z DOMU[0] DO FOLDERU KONTENERA ZE SZKLEM -for u in domy_lista.sprites()[0].smieci: - kontener_szklo.dodajSmiec(u) +########## TEST DODAWANIA SMIECI Z POJEDYNCZEGO DOMU DO FOLDERU KONTENERA ZE SZKLEM +# for u in domy_lista.sprites()[0].smieci: +# kontener_szklo.dodajSmiec(u) # ustawienie wysypiska, rozmiar wysypiska 5x5 for i in range(5): @@ -116,19 +113,16 @@ all_sprites_list.add(kontener_plastik, kontener_metal, kontener_organiczne, kont def game(): pygame.init() - # Set the HEIGHT and WIDTH of the screen obraz = pygame.display.set_mode(WINDOW_SIZE) - # Set title of screen + # Tytul okienka pygame.display.set_caption("Inteligentna śmieciarka") - # Loop until the user clicks the close button. + # Petla az uzytkownik zamknie program done = False - - # Used to manage how fast the screen updates clock = pygame.time.Clock() - # -------- Main Program Loop ----------- + # -------- Glowna petla programu ----------- while not done: # obsluga zdarzen typu nacisniecie klawisza lub przycisku myszy @@ -136,10 +130,10 @@ def game(): if event.type == pygame.QUIT: # If user clicked close done = True # Flag that we are done so we exit this loop elif event.type == pygame.MOUSEBUTTONDOWN: - # User clicks the mouse. Get the position + # Zapisywanie pozycji myszki po kliknieciu pozycja_myszki = pygame.mouse.get_pos() - # Change the x/y screen coordinates to grid coordinates + # Zamiana pozycji na konkretne koordy kolumna = pozycja_myszki[0] // (WIDTH + MARGIN) wiersz = pozycja_myszki[1] // (HEIGHT + MARGIN) @@ -157,7 +151,7 @@ def game(): if event.key == pygame.K_DOWN: smieciarka.w_dol() - # Limit to 60 frames per second + # Odswiezanie 5 klatek na sekunde clock.tick(5) # czarny kolor w tle @@ -184,6 +178,6 @@ def game(): plansza[7, 11].setJestPrzeszkoda(True) all_sprites_list.draw(obraz) smieciarka.rand_move() - # Go ahead and update the screen with what we've drawn. + pygame.display.flip() pygame.quit() diff --git a/modele.py b/modele.py index b79aacd..c53e6f4 100644 --- a/modele.py +++ b/modele.py @@ -1,16 +1,14 @@ import pygame import game import random -import numpy as np -import random import os import shutil -# This sets the WIDTH and HEIGHT of each grid location +# wysokosc i szerokosc kazdej kratki WIDTH = 60 HEIGHT = 60 -# This sets the margin between each cell +# margines pomiedzy kratkami MARGIN = 5 # kolory