37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
import pygame
|
|
from pygame.locals import *
|
|
from Forklift import Forklift
|
|
|
|
HORIZONTAL = 1250
|
|
VERTICAL = 750
|
|
|
|
TILE_SIZE = 50
|
|
|
|
class Program:
|
|
def __init__(self):
|
|
pygame.init()
|
|
self.window = pygame.display.set_mode((HORIZONTAL, VERTICAL))
|
|
self.caption = pygame.display.set_caption('Autonomiczny wózek widłowy')
|
|
self.agent = Forklift(self.window)
|
|
self.agent.drawForklift()
|
|
|
|
def run(self):
|
|
running = True
|
|
while running:
|
|
for event in pygame.event.get():
|
|
if event.type == KEYDOWN:
|
|
if event.key == K_RIGHT:
|
|
self.agent.moveForkliftRight()
|
|
if event.key == K_LEFT:
|
|
self.agent.moveForkliftLeft()
|
|
if event.key == K_UP:
|
|
self.agent.moveForkliftUp()
|
|
if event.key == K_DOWN:
|
|
self.agent.moveForkliftDown()
|
|
if event.key == K_ESCAPE:
|
|
running = False
|
|
elif event.type == pygame.QUIT:
|
|
running = False
|
|
|
|
|