dodanie czesci ikonek warzyw

This commit is contained in:
Zofia Lorenc 2024-04-15 03:40:46 +02:00
parent 699185b0c9
commit f6d9fa609e
8 changed files with 10 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -28,10 +28,20 @@ class Tile(pygame.sprite.Sprite):
def draw(self, surface):
self.tiles.draw(surface)
def set_type(self, type):
self.type = type
image_path = f"images/vegetables/{self.type}.png"
if os.path.exists(image_path):
self.image = pygame.image.load(image_path).convert()
else:
self.image = pygame.image.load("images/grass.png").convert()
self.image = pygame.transform.scale(self.image, (TILE_SIZE, TILE_SIZE))
'''
def set_type(self, type):
self.type = type
# if self.type == 'grass':
# self.image = pygame.image.load("images/grass.png").convert()
self.image = pygame.image.load("images/grass.png").convert()
self.image = pygame.transform.scale(self.image, (TILE_SIZE, TILE_SIZE))
'''