feat(tractor): add basic watering functionality
This commit is contained in:
parent
09b65e9fd1
commit
7c30177bf1
@ -17,6 +17,8 @@ class Tractor(pygame.sprite.Sprite):
|
||||
x, y = 0, 0
|
||||
self.rect.topleft = (x, y)
|
||||
|
||||
self.water = 200
|
||||
|
||||
def draw(self, surface):
|
||||
surface.blit(self.image, self.rect)
|
||||
|
||||
@ -39,7 +41,12 @@ class Tractor(pygame.sprite.Sprite):
|
||||
self.print_tile_type()
|
||||
|
||||
curent_tile = self.get_current_tile()
|
||||
print(ile_podlac(curent_tile.type, curent_tile.faza))
|
||||
water_needed = ile_podlac(curent_tile.type, curent_tile.faza)[0]['Woda']
|
||||
if self.water >= water_needed:
|
||||
print(f"watered {curent_tile.type} with {water_needed} liters\n")
|
||||
self.water -= water_needed
|
||||
else:
|
||||
print(f"{water_needed - self.water} more litres of water needed to water {curent_tile.type}\n")
|
||||
|
||||
def update(self):
|
||||
keys = pygame.key.get_pressed()
|
||||
|
Loading…
Reference in New Issue
Block a user