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): def draw(self, surface):
self.tiles.draw(surface) self.tiles.draw(surface)
self.tractor.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

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