diff --git a/src/tile.py b/src/tile.py index b4b9e577..94f78652 100644 --- a/src/tile.py +++ b/src/tile.py @@ -1,6 +1,9 @@ import os import pygame from dotenv import find_dotenv, load_dotenv +from kb import tractor_kb +import pytholog as pl +import random class Tile(pygame.sprite.Sprite): def __init__(self, id, type, field): @@ -8,9 +11,13 @@ class Tile(pygame.sprite.Sprite): self.id = id x = id%16 y = id//16 + + vegetable_types = tractor_kb.query(pl.Expr("warzywo(X)")) + random_vegetable = vegetable_types[random.randint(0, len(vegetable_types)-1)]['X'] + self.type = type self.field = field - self.set_type(type) + self.set_type(random_vegetable) self.rect = self.image.get_rect() # you can set TILE_SIZE in the .env file to adjust the window size load_dotenv(find_dotenv()) @@ -22,8 +29,10 @@ class Tile(pygame.sprite.Sprite): def set_type(self, type): self.type = type - if self.type == 'grass': - self.image = pygame.image.load("images/grass.png").convert() + # if self.type == 'grass': + # self.image = pygame.image.load("images/grass.png").convert() + self.image = pygame.image.load("images/grass.png").convert() + # you can set TILE_SIZE in the .env file to adjust the window size load_dotenv(find_dotenv()) TILE_SIZE = int(os.getenv("TILE_SIZE"))