Update 'src/main.py'

This commit is contained in:
Bogdan Panov 2021-05-28 22:43:41 +02:00
parent 9a74d214b5
commit 449c6de5d1

View File

@ -15,9 +15,10 @@ QTY_OF_PACKAGES = 8
RECT_SIZE = 9
data_tree = load_tree_from_structure('tree/tree_model')
IMAGE = pygame.image.load('img/wozek2.png')
IMAGE = pygame.transform.scale(pygame.image.load('img/wozek2.png'), (75, 75))
BACKGROUND = pygame.transform.scale(pygame.image.load('img/background.png'), (WIDTH, HEIGHT))
DOCK = pygame.transform.scale(pygame.image.load('img/dock_left.png'), (75, 75))
TRASH = pygame.transform.scale(pygame.image.load('img/trash.png'), (75, 75))
get_pix_from_position = {}
@ -42,7 +43,7 @@ def create_positions():
def generate_package(a, b):
name_list = ['Grocery', 'Builders', 'Electronic', 'Explosive']
image_list = ['img/package_grocery.png', 'img/package_builders.png', 'img/package.png', 'img/package_explosive.png']
image_list = ['img/package_grocery.png', 'img/package_builders.png', 'img/electronics.png', 'img/package_explosive.png']
rand_type = random.randint(1, 4)
#rand_weight = generate_weight()
rand_weight = random.randint(1, 10)
@ -96,8 +97,9 @@ class Shelf:
class Stain:
def __init__(self, pos):
stains_list = ['img/stain.png', 'img/stain2.png', 'img/stain3.png']
self.pos_pix = get_pix_from_position[pos]
self.image = pygame.transform.scale(pygame.image.load("img/stain.png"), (60, 60))
self.image = pygame.transform.scale(pygame.image.load(stains_list[random.randint(0,1)]), (60, 60))
self.rect = self.image.get_rect(center=self.pos_pix)
@ -297,7 +299,7 @@ while running:
# DRAWING
screen.blit(BACKGROUND, [0, 0])
screen.blit(DOCK, [0, 0])
screen.blit(pygame.transform.flip(DOCK, True, False), [8 * size, 0])
screen.blit(TRASH, [8 * size, 0])
screen.blit(board, board.get_rect())
for shelf in Shelf_list:
screen.blit(shelf.image, shelf.rect)