diff --git a/field.py b/field.py index 0b53d2d..f674883 100644 --- a/field.py +++ b/field.py @@ -44,11 +44,17 @@ class field(): def pogoda(self): number = random.randrange(0, 4) - if number==0: + return number + + def get_pogoda_value(self): + return self.weather + + def get_pogoda_name(self): + if self.weather==0: return 'slonecznie' - elif number==1: + elif self.weather==1: return 'deszcz' - elif number==2: + elif self.weather==2: return 'grad' - elif number==3: + elif self.weather==3: return 'zachmurzenie' \ No newline at end of file diff --git a/main.py b/main.py index a0bda4d..c11dca1 100644 --- a/main.py +++ b/main.py @@ -60,7 +60,7 @@ while True: print(traktor.get_poz()) if key[K_F11]: print(traktor.get_field_value()) - if key[K_12]: + if key[K_F12]: c.main() UI.update() diff --git a/ui.py b/ui.py index 29daa46..3c8a9cd 100644 --- a/ui.py +++ b/ui.py @@ -14,6 +14,8 @@ class game_ui(): self.POLE_COL = (128, 128, 0) self.POLE_POZ = (75, 75) self.text_rect = [self.POLE_POZ[0], self.POLE_WYS + self.POLE_POZ[1] + 100] + self.pogoda_rect = [self.POLE_POZ[0], self.POLE_WYS + self.POLE_POZ[1] + 125] + self.text_weather = "Pogoda: "+self.field.get_pogoda_name() # Init pola gry self.okno = pygame.display.set_mode((self.szer, self.wys), 0, 32) @@ -50,9 +52,12 @@ class game_ui(): self.okno.blit(self.pole1_surf, self.pole1_surf_rect) self.okno.blit(self.pole_surf, self.pole_surf_rect) self.text_value = "Ile ruchów: " + str(self.traktor.get_moves()) + " Tryb: " + self.traktor.get_mode_name() + self.font = pygame.font.Font('freesansbold.ttf', 24) self.text = self.font.render(self.text_value, True, (0, 0, 0), self.col) + self.text_pogoda = self.font.render(self.text_weather, True,(0, 0, 0), self.col) self.okno.blit(self.text, self.text_rect) + self.okno.blit(self.text_pogoda, self.pogoda_rect) for i in range(0, 10): for j in range(0, 10): self.pole_surf.blit(self.field_images[self.field.get_value([i,j])], (i*70, j*70))