This commit is contained in:
s1202077 2019-03-19 18:40:36 +01:00
parent 219f523dac
commit 7392c8d3c4
3 changed files with 5 additions and 13 deletions

View File

@ -35,13 +35,6 @@ for x in range(PLAY_HEIGHT//64):
grass = Grass(x,y) grass = Grass(x,y)
cells[x].append(grass) 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 #Losowanie domków i dodawanie je do mapy
home_len = home_amount home_len = home_amount
while( home_len > 0 ): while( home_len > 0 ):

View File

@ -11,16 +11,16 @@ class House(Cell):
Cell.__init__(self,x,y) Cell.__init__(self,x,y)
self.image = pygame.image.load("images/house.png") self.image = pygame.image.load("images/house.png")
self.rubbish = [0,0,0] #plastic, glass, metal self.rubbish = [0,0,0] #plastic, glass, metal
self.max_plastic = max_plastic self.max_plastic = max_plastic
self.max_glass = max_glass self.max_glass = max_glass
self.max_metal = max_metal self.max_metal = max_metal
def generate_rubbish(self): def generate_rubbish(self):
if( random.randint(0, 5) == 1 ): #1/5 szansa na wyrzucenie śmiecia w klatce if( random.randint(0, 5) == 1 ): #1/5 szansa na wyrzucenie śmiecia w klatce
thrash_type = random.randint(0,2) thrash_type = random.randint(0,2)
self.rubbish[thrash_type] = self.rubbish[thrash_type] + 1 self.rubbish[thrash_type] = self.rubbish[thrash_type] + 1
if( self.rubbish[PLASTIC] > self.max_plastic ): if( self.rubbish[PLASTIC] > self.max_plastic ):
self.image = pygame.image.load("images/house_plastic.png") self.image = pygame.image.load("images/house_plastic.png")
print("PLASTIC alert") print("PLASTIC alert")
@ -30,7 +30,6 @@ class House(Cell):
if( self.rubbish[METAL] > self.max_metal ): if( self.rubbish[METAL] > self.max_metal ):
self.image = pygame.image.load("images/house_metal.png") self.image = pygame.image.load("images/house_metal.png")
print("METAL alert") print("METAL alert")
def check_rubbish_status(self): def check_rubbish_status(self):
print( "plastic: " + str(self.rubbish[PLASTIC]) + " glass: " + str(self.rubbish[GLASS]) + " metal: " + str(self.rubbish[METAL]) ) print( "plastic: " + str(self.rubbish[PLASTIC]) + " glass: " + str(self.rubbish[GLASS]) + " metal: " + str(self.rubbish[METAL]) )

View File

@ -7,7 +7,7 @@ def set_home_amount():
for o, amount in optlist: for o, amount in optlist:
if o == '--home-count': if o == '--home-count':
return int(amount) return int(amount)
print('missing argument: --home-count <amount>') print('Missing argument: --home-count <amount>')
sys.exit(2) sys.exit(2)
except getopt.GetoptError as err: except getopt.GetoptError as err:
print(err) print(err)