diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..73ffb59
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,112 @@
+
+# Created by https://www.gitignore.io/api/python
+# Edit at https://www.gitignore.io/?templates=python
+
+### Python ###
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+pip-wheel-metadata/
+share/python-wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+
+/idea/workspace.xml
+MANIFEST
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.nox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+.hypothesis/
+.pytest_cache/
+
+# Translations
+*.mo
+*.pot
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+# pyenv
+.python-version
+
+# pipenv
+# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
+# However, in case of collaboration, if having platform-specific dependencies or dependencies
+# having no cross-platform support, pipenv may install dependencies that don't work, or not
+# install all needed dependencies.
+#Pipfile.lock
+
+# celery beat schedule file
+celerybeat-schedule
+
+# SageMath parsed files
+*.sage.py
+
+# Spyder project settings
+.spyderproject
+.spyproject
+
+# Rope project settings
+.ropeproject
+
+# Mr Developer
+.mr.developer.cfg
+.project
+.pydevproject
+
+# mkdocs documentation
+/site
+
+# mypy
+.mypy_cache/
+.dmypy.json
+dmypy.json
+
+# Pyre type checker
+.pyre/
+
+# End of https://www.gitignore.io/api/python
\ No newline at end of file
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..e7e9d11
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,2 @@
+# Default ignored files
+/workspace.xml
diff --git a/.idea/ProjektAI.iml b/.idea/ProjektAI.iml
new file mode 100644
index 0000000..8b8c395
--- /dev/null
+++ b/.idea/ProjektAI.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
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..6649a8c
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..44f5414
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/kelner/main.py b/kelner/main.py
index e206b56..0a056e3 100644
--- a/kelner/main.py
+++ b/kelner/main.py
@@ -1,33 +1,76 @@
import pygame
+import time
-#initialize the pygame
+# initialize the pygame
pygame.init()
-#create the screen
+# initiate variables
screen = pygame.display.set_mode((1000,1000))
-
-#caption
pygame.display.set_caption("Bardzo mÄ…dry kelner")
-#grid
+# Grid variables
gridImg = pygame.image.load("20x20grid.png")
gridX = 0
gridY = 0
-#weiter
+# Waiter variables
waiterImg = pygame.image.load("waiter.png")
waiterX = 10
-waiterY = 1
+waiterY = 10
+
+
+# TODO: classes in separate folders
+
+
+class Grid:
+
+ def __init__(self, g_x, g_y, grid_img):
+ self.g_x = g_x
+ self.g_y = g_y
+
+ self.grid_img = grid_img
+
+ def draw_grid(self):
+ global screen
+ screen.blit(self.grid_img, (self.g_x, self.g_y))
+
+
+class Waiter:
+ def __init__(self, w_x, w_y, waiter_img):
+ self.waiter_img = waiter_img
+ self.w_x = w_x
+ self.w_y = w_y
+ self.position = [w_x, w_y]
+
+ def draw_waiter(self):
+ global screen
+ screen.blit(self.waiter_img, self.position)
+
+ def move_left(self, w_x):
+ self.position[0] = (self.position[0]-w_x) % 1000
+ screen.blit(self.waiter_img, self.position)
+
+ def move_right(self, w_x):
+ self.position[0] = (self.position[0]+w_x) % 1000
+ screen.blit(self.waiter_img, self.position)
+
+ def move_up(self, w_y):
+ self.position[1] = (self.position[1]-w_y) % 1000
+ screen.blit(self.waiter_img, self.position)
+
+ def move_down(self, w_y):
+ self.position[1] = (self.position[1]+w_y) % 1000
+ screen.blit(self.waiter_img, self.position)
+
+
+# waiter
waiterX_change = 0
waiterY_change = 0
-def grid():
- screen.blit(gridImg, (gridX,gridY))
+grid = Grid(gridX, gridY, gridImg)
+waiter = Waiter(waiterX, waiterY, waiterImg)
-def waiter(x, y):
- screen.blit(waiterImg, (x,y))
-
-#loop
+# loop
running = True
while running:
@@ -37,24 +80,26 @@ while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
-
+# TODO: switch case
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
- waiterX_change = -50
+ waiter.move_left(20)
if event.key == pygame.K_RIGHT:
- waiterX_change = 50
+ waiter.move_right(20)
if event.key == pygame.K_UP:
- waiterY_change = -50
+ waiter.move_up(20)
if event.key == pygame.K_DOWN:
- waiterY_change = 50
+ waiter.move_down(20)
+
+ # do czego to ???
if event.type == pygame.KEYUP:
if event.key == pygame.K_LEFT or event.key == pygame.K_RIGHT:
waiterX_change = 0
if event.key == pygame.K_UP or event.key == pygame.K_DOWN:
waiterY_change = 0
- grid()
- waiterX += waiterX_change
- waiterY += waiterY_change
- waiter(waiterX, waiterY)
- pygame.display.update()
\ No newline at end of file
+ grid.draw_grid()
+ waiter.draw_waiter()
+ pygame.display.update()
+ time.sleep(0.1)
+