feat: adding water tiles

1/3 of free tiles are now water. water.png obviously is a prototype (it's ugly).
This commit is contained in:
Adam Mikolajczak 2024-05-10 11:21:15 +02:00
parent f85f5b4cdc
commit c30d6ffc5c
3 changed files with 7 additions and 1 deletions

View File

@ -14,3 +14,4 @@ class Field:
def draw(self, surface):
self.tiles.draw(surface)
self.tractor.draw(surface)

BIN
src/images/water.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -20,6 +20,9 @@ class Tile(pygame.sprite.Sprite):
vegetables = tractor_kb.query(pl.Expr("warzywo(Nazwa_warzywa)"))
random_vegetable = vegetables[random.randint(0, len(vegetables)-1)]['Nazwa_warzywa']
self.set_type(random_vegetable)
else:
if random.randint(1, 10) % 3 == 0:
self.set_type('water')
else:
self.set_type('grass')
@ -36,6 +39,8 @@ class Tile(pygame.sprite.Sprite):
self.type = type
if self.type == 'grass':
image_path = "images/grass.png"
elif self.type == 'water':
image_path = "images/water.png"
else:
image_path = f"images/vegetables/{self.type}.png"
if not os.path.exists(image_path):