2020-03-23 20:55:52 +01:00
|
|
|
import sys
|
2020-04-05 16:37:25 +02:00
|
|
|
|
2020-04-03 18:49:47 +02:00
|
|
|
from src.graphics import *
|
2020-04-05 16:37:25 +02:00
|
|
|
from src.waiter import *
|
2020-03-23 20:55:52 +01:00
|
|
|
|
2020-04-03 18:49:47 +02:00
|
|
|
if __name__ == "__main__":
|
|
|
|
# SETUP
|
|
|
|
pygame.init()
|
|
|
|
clock = pygame.time.Clock()
|
|
|
|
fps = 40
|
|
|
|
graphics = Graphics()
|
2020-04-05 16:37:25 +02:00
|
|
|
waiter = Waiter(graphics)
|
2020-04-26 18:26:55 +02:00
|
|
|
direction = 0
|
2020-04-03 00:36:09 +02:00
|
|
|
|
2020-04-03 18:49:47 +02:00
|
|
|
# init functions
|
2020-04-03 20:15:07 +02:00
|
|
|
graphics.drawBackground(waiter.matrix)
|
2020-04-26 18:26:55 +02:00
|
|
|
graphics.update(waiter.X, waiter.Y, waiter.direction)
|
2020-03-23 20:55:52 +01:00
|
|
|
|
2020-04-03 18:49:47 +02:00
|
|
|
while True:
|
2020-03-23 20:55:52 +01:00
|
|
|
for event in pygame.event.get():
|
|
|
|
if event.type == pygame.QUIT:
|
|
|
|
pygame.quit()
|
|
|
|
sys.exit()
|
2020-04-03 18:49:47 +02:00
|
|
|
break
|
|
|
|
|
2020-04-02 22:28:30 +02:00
|
|
|
if event.type == pygame.KEYDOWN:
|
2020-04-03 18:49:47 +02:00
|
|
|
if event.key == pygame.K_ESCAPE:
|
|
|
|
pygame.quit()
|
|
|
|
sys.exit()
|
|
|
|
break
|
|
|
|
|
2020-04-03 20:15:07 +02:00
|
|
|
graphics.clear(waiter.X, waiter.Y)
|
2020-04-26 18:26:55 +02:00
|
|
|
waiter.update(event, graphics, direction)
|
|
|
|
graphics.update(waiter.X, waiter.Y, waiter.direction)
|
2020-04-02 23:26:17 +02:00
|
|
|
pygame.display.flip()
|
2020-04-02 22:28:30 +02:00
|
|
|
clock.tick(fps)
|