2019-03-19 23:36:06 +01:00
|
|
|
import pygame, sys
|
|
|
|
from waiter import Waiter
|
|
|
|
from table import Table
|
2019-03-20 20:42:55 +01:00
|
|
|
from gridElement import GridEleemnt
|
2019-03-19 23:36:06 +01:00
|
|
|
|
|
|
|
class Game(object):
|
|
|
|
def __init__(self):
|
|
|
|
pygame.init()
|
|
|
|
|
|
|
|
self.screen = pygame.display.set_mode((1000, 900))
|
|
|
|
self.fpsClock = pygame.time.Clock()
|
|
|
|
self.idTable = 0
|
2019-03-20 20:42:55 +01:00
|
|
|
self.idOrder = 0
|
2019-03-19 23:36:06 +01:00
|
|
|
pygame.display.set_caption('Automatic Waiter')
|
|
|
|
self.background = pygame.image.load("./Images/tlo.jpg")
|
|
|
|
|
|
|
|
self.waiter = Waiter(self)
|
|
|
|
self.tables = [Table(50, 50, self), Table(400, 50, self), Table(750, 50, self), Table(50, 450, self), Table(400, 450, self), Table(750, 450, self)]
|
2019-03-20 20:42:55 +01:00
|
|
|
self.grid = []
|
|
|
|
for i in range(20):
|
|
|
|
for b in range(18):
|
|
|
|
self.grid.append(GridEleemnt(i*50, b*50, self))
|
2019-03-19 23:36:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
for t in self.tables:
|
|
|
|
print(t.id)
|
|
|
|
|
|
|
|
while True:
|
|
|
|
|
|
|
|
for event in pygame.event.get():
|
|
|
|
if event.type == pygame.QUIT:
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
#self.screen.fill((0, 0, 0))
|
2019-03-20 20:42:55 +01:00
|
|
|
#self.screen.blit(self.background, (0, 0))
|
2019-03-19 23:36:06 +01:00
|
|
|
self.draw()
|
|
|
|
self.waiter.move()
|
|
|
|
pygame.display.flip()
|
|
|
|
|
|
|
|
self.fpsClock.tick(10)
|
|
|
|
|
|
|
|
|
|
|
|
def draw(self):
|
2019-03-20 20:42:55 +01:00
|
|
|
for gridElement in self.grid:
|
|
|
|
gridElement.draw()
|
2019-03-19 23:36:06 +01:00
|
|
|
self.waiter.draw()
|
|
|
|
for table in self.tables:
|
|
|
|
table.draw()
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
Game()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|