From 1b9049d613667796a37b2e9a3b272d5dbc360358 Mon Sep 17 00:00:00 2001 From: shaaqu Date: Tue, 9 Jun 2020 20:46:21 +0200 Subject: [PATCH] 3 levels on shelf.py --- board.py | 3 --- shelf.py | 12 ++++++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/board.py b/board.py index b8c5b7f..1d2b2f0 100644 --- a/board.py +++ b/board.py @@ -8,9 +8,6 @@ shelfs_o = [] def create_board(screen): board = [] - # # shelfs = [(250, 150), (250, 250), (450, 150), (450, 250), (650, 150), (650, 250), (850, 150), (850, 250), - # (250, 450), (350, 450), (750, 450), (850, 450), - # (250, 650), (250, 750), (450, 650), (450, 750), (650, 650), (650, 750), (850, 650), (850, 750)] shelfs = [ (50, 50), (150, 50), (450, 50), (550, 50), (850, 50), (950, 50), diff --git a/shelf.py b/shelf.py index 851954b..de8eaea 100644 --- a/shelf.py +++ b/shelf.py @@ -6,10 +6,18 @@ class Shelf: def __init__(self, x, y): self.x = x self.y = y - self.products = [] + self.level1 = [] + self.level2 = [] + self.level3 = [] + def add_product(self, product): - self.products.append(product) + if product[7] == 1: + self.level1.append(product) + elif product[7] == 2: + self.level2.append(product) + else: + self.level3.append(product) def get_product(self): return self.products[0]