środowisko
This commit is contained in:
parent
b220fe80d9
commit
e1c44f04e2
8
.idea/.gitignore
vendored
Normal file
8
.idea/.gitignore
vendored
Normal file
@ -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
|
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
4
.idea/misc.xml
Normal file
4
.idea/misc.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (sztuczna)" project-jdk-type="Python SDK" />
|
||||||
|
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/sztuczna.iml" filepath="$PROJECT_DIR$/.idea/sztuczna.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
10
.idea/sztuczna.iml
Normal file
10
.idea/sztuczna.iml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
87
main.py
Normal file
87
main.py
Normal file
@ -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()
|
BIN
resources/images.png
Normal file
BIN
resources/images.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
BIN
resources/indeks.png
Normal file
BIN
resources/indeks.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Loading…
Reference in New Issue
Block a user