diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..1f966c0 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..b8078c4 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/sztuczna.iml b/.idea/sztuczna.iml new file mode 100644 index 0000000..74d515a --- /dev/null +++ b/.idea/sztuczna.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..3596472 --- /dev/null +++ b/main.py @@ -0,0 +1,87 @@ +import pygame +from pygame.locals import * + +HORIZONTAL = 1250 # poziomy wymiar okna +VERTICAL = 750 # pionowy wymiar okna + +TILE_SIZE = 50 # rozmiar kafelka + +background = (49, 51, 53) # kolor tla +line_color = (85, 85, 85) # kolor linii +shelf = (138, 126, 74) # kolor polki + +window = pygame.display.set_mode((HORIZONTAL, VERTICAL)) # okno 1250 x 750 +pygame.display.set_caption('Autonomiczny wózek widłowy') + +def drawGrid(): + num_of_columns = int(HORIZONTAL / TILE_SIZE) + num_of_rows = int(VERTICAL / TILE_SIZE) + x = 0 + y = 0 + for i in range(num_of_columns): + x += TILE_SIZE + pygame.draw.line(window, line_color, (x, 0), (x, VERTICAL)) + for i in range(num_of_rows): + y += TILE_SIZE + pygame.draw.line(window, line_color, (0, y), (HORIZONTAL, y)) + +def drawShelves(): + width = 5 * TILE_SIZE + height = TILE_SIZE + for i in range(TILE_SIZE + 1, HORIZONTAL - TILE_SIZE, 6 * TILE_SIZE): + pygame.draw.rect(window, shelf, pygame.Rect(i, 0, width, height)) + pygame.draw.rect(window, shelf, pygame.Rect(i, 101, width, height)) + pygame.draw.rect(window, shelf, pygame.Rect(i, 201, width, height)) + pygame.draw.rect(window, shelf, pygame.Rect(i, 501, width, height)) + pygame.draw.rect(window, shelf, pygame.Rect(i, 601, width, height)) + pygame.draw.rect(window, shelf, pygame.Rect(i, 701, width, height)) + +class Forklift: + def __init__(self): + self.image = pygame.image.load('resources/images.png').convert_alpha() + self.x = 50 + self.y = 350 + + def drawForklift(self): + window.blit(self.image, (self.x, self.y)) + +class Package: + def __init__(self): + self.image = pygame.image.load('resources/indeks.png').convert_alpha() + self.x = 1150 + self.y = 350 + + def drawPackage(self): + window.blit(self.image, (self.x, self.y)) + +def run(): + running = True + + forklift = Forklift() + package = Package() + + while running: + for event in pygame.event.get(): + if event.type == KEYDOWN: + if event.key == K_RIGHT: + forklift.x += TILE_SIZE + if event.key == K_LEFT: + forklift.x -= TILE_SIZE + if event.key == K_UP: + forklift.y -= TILE_SIZE + if event.key == K_DOWN: + forklift.y += TILE_SIZE + if event.key == K_ESCAPE: + running = False + elif event.type == pygame.QUIT: + running = False + + window.fill(background) + drawGrid() + drawShelves() + forklift.drawForklift() + package.drawPackage() + pygame.display.flip() + +if __name__ == "__main__": + run() diff --git a/resources/images.png b/resources/images.png new file mode 100644 index 0000000..71c58d2 Binary files /dev/null and b/resources/images.png differ diff --git a/resources/indeks.png b/resources/indeks.png new file mode 100644 index 0000000..ce7527f Binary files /dev/null and b/resources/indeks.png differ