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):
@ -58,3 +59,6 @@ class field():
return 'grad'
elif self.weather==3:
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()

3
ui.py
View File

@ -65,3 +65,6 @@ class game_ui():
self.okno.blit(self.traktor_actual_img,self.traktor.get_poz_on_screen())
# aktualizacja okna i wyświetlenie
pygame.display.update()
def pogoda(self):
self.text_weather = "Pogoda: "+self.field.get_pogoda_name()