From 3347e7cf68ef9c468dd736e6fde2ee1df7b7abdb Mon Sep 17 00:00:00 2001 From: michalStarski Date: Tue, 19 Mar 2019 18:40:36 +0100 Subject: [PATCH] mend --- game.py | 8 +------- sprites/house.py | 9 ++++----- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/game.py b/game.py index 1b5d153..9b531b2 100644 --- a/game.py +++ b/game.py @@ -35,13 +35,6 @@ for x in range(PLAY_HEIGHT//64): grass = Grass(x,y) cells[x].append(grass) -for x in range(PLAY_HEIGHT//64): - cells.append([]) - for y in range(PLAY_HEIGHT//64): - grass = Grass(x,y) - cells[x].append(grass) -print( cells ) - #Losowanie domków i dodawanie je do mapy home_len = home_amount while( home_len > 0 ): @@ -51,6 +44,7 @@ while( home_len > 0 ): y = random.randint(0, (PLAY_WIDTH//64)-1) if( type(cells[x][y]) == Grass ): + print('Moge byc domkiem!') cells[x][y] = House(x,y, 10, 10, 10) home_len = home_len - 1 diff --git a/sprites/house.py b/sprites/house.py index b3f676d..545cb56 100644 --- a/sprites/house.py +++ b/sprites/house.py @@ -11,16 +11,16 @@ class House(Cell): Cell.__init__(self,x,y) self.image = pygame.image.load("images/house.png") self.rubbish = [0,0,0] #plastic, glass, metal - + self.max_plastic = max_plastic self.max_glass = max_glass self.max_metal = max_metal - + def generate_rubbish(self): if( random.randint(0, 5) == 1 ): #1/5 szansa na wyrzucenie śmiecia w klatce thrash_type = random.randint(0,2) self.rubbish[thrash_type] = self.rubbish[thrash_type] + 1 - + if( self.rubbish[PLASTIC] > self.max_plastic ): self.image = pygame.image.load("images/house_plastic.png") print("PLASTIC alert") @@ -30,7 +30,6 @@ class House(Cell): if( self.rubbish[METAL] > self.max_metal ): self.image = pygame.image.load("images/house_metal.png") print("METAL alert") - + def check_rubbish_status(self): print( "plastic: " + str(self.rubbish[PLASTIC]) + " glass: " + str(self.rubbish[GLASS]) + " metal: " + str(self.rubbish[METAL]) ) - \ No newline at end of file