Zmiana pogody pod F4

This commit is contained in:
Marcin Kwapisz 2020-06-09 23:45:21 +02:00
parent d7deb4900c
commit 81fe6f66ee
3 changed files with 13 additions and 2 deletions

View File

@ -44,6 +44,7 @@ class field():
def pogoda(self):
number = random.randrange(0, 4)
print(number)
return number
def get_pogoda_value(self):
@ -57,4 +58,7 @@ class field():
elif self.weather==2:
return 'grad'
elif self.weather==3:
return 'zachmurzenie'
return 'zachmurzenie'
def change_weather(self):
self.weather = self.pogoda()

View File

@ -42,6 +42,10 @@ while True:
traktor.set_mode(3)
if key[K_p]:
path.pathfinding(traktor,pole,UI)
if key[K_F4]:
#Zmiana pogody
pole.change_weather()
UI.pogoda()
if key[K_F5]:
#Dla projektu Justyny
j.main()

5
ui.py
View File

@ -64,4 +64,7 @@ class game_ui():
self.traktor_actual_img = pygame.image.load('images/' + self.traktor_img[self.traktor.get_turn()])
self.okno.blit(self.traktor_actual_img,self.traktor.get_poz_on_screen())
# aktualizacja okna i wyświetlenie
pygame.display.update()
pygame.display.update()
def pogoda(self):
self.text_weather = "Pogoda: "+self.field.get_pogoda_name()