2
0
forked from s444420/AL-2020

3 levels on shelf.py

This commit is contained in:
shaaqu 2020-06-09 20:46:21 +02:00
parent 54c0d48184
commit 1b9049d613
2 changed files with 10 additions and 5 deletions

View File

@ -8,9 +8,6 @@ shelfs_o = []
def create_board(screen): def create_board(screen):
board = [] 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 = [ shelfs = [
(50, 50), (150, 50), (450, 50), (550, 50), (850, 50), (950, 50), (50, 50), (150, 50), (450, 50), (550, 50), (850, 50), (950, 50),

View File

@ -6,10 +6,18 @@ class Shelf:
def __init__(self, x, y): def __init__(self, x, y):
self.x = x self.x = x
self.y = y self.y = y
self.products = [] self.level1 = []
self.level2 = []
self.level3 = []
def add_product(self, product): 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): def get_product(self):
return self.products[0] return self.products[0]