Sztuczna_Inteligencja_2020/main.py

37 lines
951 B
Python
Raw Permalink Normal View History

2020-03-23 20:55:52 +01:00
import sys
from src.graphics import *
from src.waiter import *
2020-03-23 20:55:52 +01:00
if __name__ == "__main__":
# SETUP
pygame.init()
clock = pygame.time.Clock()
fps = 40
graphics = Graphics()
waiter = Waiter(graphics)
2020-04-26 18:26:55 +02:00
direction = 0
2020-04-03 00:36:09 +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
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()
break
2020-04-02 22:28:30 +02:00
if event.type == pygame.KEYDOWN:
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)
pygame.display.flip()
2020-04-02 22:28:30 +02:00
clock.tick(fps)