Zmiana wygladu planszy, nowe tekstury

This commit is contained in:
Arkadiusz 2019-04-16 23:12:39 +01:00
parent 0b63a53fe2
commit 030c96221d
15 changed files with 180 additions and 109 deletions

View File

@ -2,10 +2,12 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="152ea650-8e02-4ed6-aa8c-04d44b275be4" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/game.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pool.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/order.py" beforeDir="false" afterPath="$PROJECT_DIR$/order.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/run.py" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/game.py" beforeDir="false" afterPath="$PROJECT_DIR$/game.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/orderTable.py" beforeDir="false" afterPath="$PROJECT_DIR$/orderTable.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/table.py" beforeDir="false" afterPath="$PROJECT_DIR$/table.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/waiter.py" beforeDir="false" afterPath="$PROJECT_DIR$/waiter.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
@ -15,36 +17,6 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/table.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="294">
<caret line="14" column="27" selection-start-line="14" selection-start-column="27" selection-end-line="14" selection-end-column="27" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/waiter.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1092">
<caret line="55" column="20" selection-start-line="55" selection-start-column="20" selection-end-line="55" selection-end-column="20" />
<folding>
<element signature="e#0#13#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/gridElement.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="126">
<caret line="6" column="17" selection-start-line="6" selection-start-column="17" selection-end-line="6" selection-end-column="17" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/order.py">
<provider selected="true" editor-type-id="text-editor">
@ -57,35 +29,78 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/game.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1890">
<caret line="90" selection-start-line="90" selection-end-line="90" />
<state relative-caret-position="294">
<caret line="82" column="21" selection-start-line="82" selection-start-column="21" selection-end-line="82" selection-end-column="21" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Images/tlo.jpg">
<provider selected="true" editor-type-id="images" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Images/plytka.png">
<provider selected="true" editor-type-id="images" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/gridElement.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="252">
<caret line="12" column="19" lean-forward="true" selection-start-line="12" selection-start-column="19" selection-end-line="12" selection-end-column="19" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/pool.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="189">
<caret line="9" column="26" lean-forward="true" selection-start-line="9" selection-start-column="26" selection-end-line="9" selection-end-column="26" />
<folding>
<element signature="e#0#18#0" expanded="true" />
<element signature="e#0#13#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Images/tableSmall.png">
<provider selected="true" editor-type-id="images" />
<entry file="file://$PROJECT_DIR$/table.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="420">
<caret line="20" column="55" selection-start-line="20" selection-start-column="55" selection-end-line="20" selection-end-column="55" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Images/lada.png">
<provider selected="true" editor-type-id="images" />
<entry file="file://$PROJECT_DIR$/orderTable.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="273">
<caret line="13" column="32" lean-forward="true" selection-start-line="13" selection-start-column="32" selection-end-line="13" selection-end-column="32" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Images/lada.jpg">
<provider selected="true" editor-type-id="images" />
<entry file="file://$PROJECT_DIR$/1">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="21">
<caret line="1" column="8" selection-start-line="1" selection-start-column="8" selection-end-line="1" selection-end-column="8" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/orderTable.py">
<entry file="file://$PROJECT_DIR$/waiter.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="357">
<caret line="17" column="58" lean-forward="true" selection-start-line="17" selection-start-column="58" selection-end-line="17" selection-end-column="58" />
<caret line="17" column="32" lean-forward="true" selection-start-line="17" selection-start-column="32" selection-end-line="17" selection-end-column="32" />
<folding>
<element signature="e#0#13#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
@ -112,23 +127,24 @@
<list>
<option value="$PROJECT_DIR$/1" />
<option value="$PROJECT_DIR$/Images/order.py" />
<option value="$PROJECT_DIR$/table.py" />
<option value="$PROJECT_DIR$/gridElement.py" />
<option value="$PROJECT_DIR$/orderTable.py" />
<option value="$PROJECT_DIR$/waiter.py" />
<option value="$PROJECT_DIR$/run.py" />
<option value="$PROJECT_DIR$/game.py" />
<option value="$PROJECT_DIR$/order.py" />
<option value="$PROJECT_DIR$/table.py" />
<option value="$PROJECT_DIR$/waiter.py" />
<option value="$PROJECT_DIR$/orderTable.py" />
<option value="$PROJECT_DIR$/pool.py" />
<option value="$PROJECT_DIR$/game.py" />
</list>
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="-8" />
<option name="y" value="-8" />
<option name="width" value="974" />
<option name="height" value="1047" />
<option name="x" value="716" />
<option name="y" value="77" />
<option name="width" value="970" />
<option name="height" value="1050" />
</component>
<component name="ProjectLevelVcsManager">
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectView">
@ -136,7 +152,6 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
@ -153,6 +168,7 @@
<select />
</subPane>
</pane>
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
@ -260,12 +276,12 @@
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.09378293" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.18124342" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.49894625" visible="true" weight="0.13542795" />
<window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.49894625" visible="true" weight="0.29577464" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.3997833" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
@ -278,6 +294,41 @@
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
</layout>
<layout-to-restore>
<window_info id="Favorites" order="0" side_tool="true" />
<window_info content_ui="combo" id="Project" order="1" visible="true" weight="0.18125" />
<window_info id="Structure" order="2" weight="0.25" />
<window_info anchor="bottom" id="Event Log" order="0" side_tool="true" />
<window_info anchor="bottom" id="Version Control" order="1" />
<window_info anchor="bottom" id="Python Console" order="2" />
<window_info anchor="bottom" id="Terminal" order="3" />
<window_info anchor="bottom" id="Message" order="4" />
<window_info anchor="bottom" id="Find" order="5" />
<window_info anchor="bottom" id="Run" order="6" visible="true" weight="0.32979852" />
<window_info anchor="bottom" id="Debug" order="7" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="8" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="9" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="10" />
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
</layout-to-restore>
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="RECENT_FILTERS">
<map>
<entry key="Branch">
<value>
<list />
</value>
</entry>
<entry key="User">
<value>
<list />
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="Dodanie gridElement" />
@ -287,13 +338,6 @@
<option name="LAST_COMMIT_MESSAGE" value="Lada i skromne kolizje" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/1">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="1" column="8" selection-start-line="1" selection-start-column="8" selection-end-line="1" selection-end-column="8" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/Desktop/pygame-elsa/sprites/olaf.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="102">
@ -318,9 +362,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Images/tlo.jpg">
<provider selected="true" editor-type-id="images" />
</entry>
<entry file="file://$PROJECT_DIR$/Images/21_trisomy_-_Down_syndrome.png" />
<entry file="file://$USER_HOME$/Desktop/pygame-elsa/sprites/elsa.py">
<provider selected="true" editor-type-id="text-editor">
@ -342,23 +383,37 @@
<entry file="file://$PROJECT_DIR$/Images/lada.png">
<provider selected="true" editor-type-id="images" />
</entry>
<entry file="file://$PROJECT_DIR$/run.py">
<entry file="file://$PROJECT_DIR$/run.py" />
<entry file="file://$PROJECT_DIR$/Images/tableSmall.png">
<provider selected="true" editor-type-id="images" />
</entry>
<entry file="file://$PROJECT_DIR$/Images/water.jpg">
<provider selected="true" editor-type-id="images" />
</entry>
<entry file="file://$PROJECT_DIR$/Images/plytka.png">
<provider selected="true" editor-type-id="images" />
</entry>
<entry file="file://$PROJECT_DIR$/Images/tlo.jpg">
<provider selected="true" editor-type-id="images" />
</entry>
<entry file="file://$PROJECT_DIR$/table.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="420">
<caret line="20" selection-start-line="20" selection-end-line="20" />
<folding>
<element signature="e#0#18#0" expanded="true" />
</folding>
<caret line="20" column="55" selection-start-line="20" selection-start-column="55" selection-end-line="20" selection-end-column="55" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/game.py">
<entry file="file://$PROJECT_DIR$/1">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1890">
<caret line="90" selection-start-line="90" selection-end-line="90" />
<folding>
<element signature="e#0#18#0" expanded="true" />
</folding>
<state relative-caret-position="21">
<caret line="1" column="8" selection-start-line="1" selection-start-column="8" selection-end-line="1" selection-end-column="8" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/orderTable.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="273">
<caret line="13" column="32" lean-forward="true" selection-start-line="13" selection-start-column="32" selection-end-line="13" selection-end-column="32" />
</state>
</provider>
</entry>
@ -369,37 +424,37 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Images/tableSmall.png">
<provider selected="true" editor-type-id="images" />
</entry>
<entry file="file://$PROJECT_DIR$/gridElement.py">
<entry file="file://$PROJECT_DIR$/pool.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="126">
<caret line="6" column="17" selection-start-line="6" selection-start-column="17" selection-end-line="6" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/waiter.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1092">
<caret line="55" column="20" selection-start-line="55" selection-start-column="20" selection-end-line="55" selection-end-column="20" />
<state relative-caret-position="189">
<caret line="9" column="26" lean-forward="true" selection-start-line="9" selection-start-column="26" selection-end-line="9" selection-end-column="26" />
<folding>
<element signature="e#0#13#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/table.py">
<entry file="file://$PROJECT_DIR$/gridElement.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="294">
<caret line="14" column="27" selection-start-line="14" selection-start-column="27" selection-end-line="14" selection-end-column="27" />
<state relative-caret-position="252">
<caret line="12" column="19" lean-forward="true" selection-start-line="12" selection-start-column="19" selection-end-line="12" selection-end-column="19" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/orderTable.py">
<entry file="file://$PROJECT_DIR$/game.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="294">
<caret line="82" column="21" selection-start-line="82" selection-start-column="21" selection-end-line="82" selection-end-column="21" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/waiter.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="357">
<caret line="17" column="58" lean-forward="true" selection-start-line="17" selection-start-column="58" selection-end-line="17" selection-end-column="58" />
<caret line="17" column="32" lean-forward="true" selection-start-line="17" selection-start-column="32" selection-end-line="17" selection-end-column="32" />
<folding>
<element signature="e#0#13#0" expanded="true" />
</folding>
</state>
</provider>
</entry>

BIN
Images/drewno.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
Images/waiter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
Images/water.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

18
game.py
View File

@ -4,12 +4,13 @@ from table import Table
from gridElement import GridElement
from pygame.math import Vector2
from orderTable import OrderTable
from pool import Pool
class Game(object):
def __init__(self):
pygame.init()
self.x = 20
self.y = 18
self.x = 10
self.y = 10
self.screen = pygame.display.set_mode((self.x * 50, self.y * 50))
self.fpsClock = pygame.time.Clock()
self.idTable = 0
@ -27,19 +28,22 @@ class Game(object):
for b in range(self.y):
for i in range(self.x):
if ((i == 0) or (i == 8) or (i == 16)) and ((b == 2) or (b == 8)):
if ((i == 0) or (i == 9)) and ((b == 0) or (b == 6)):
self.row.append(Table(i * 50, b * 50, self))
elif b == self.y-1 and (i == 10 or i == 11 or i == 12 or i == 13 or i == 14 or i == 15):
elif (b == self.y-1 or b == self.y-2 or b == self.y-3) and (i == 5):
table = OrderTable(i * 50, b * 50, self)
self.row.append(table)
self.tableList.append(table)
elif i == 18 and b == 14:
elif i == 4 and b == 9:
self.row.append(Waiter(self, i * 50, b * 50))
self.waiterNumberInGrid.x = i
self.waiterNumberInGrid.y = b
elif (((b > 0 and b < 6) and (i > 0 and i < 9)) and not((i==1 or i == 8) and (b==1 or b==5))) \
or (b>6 and (i<4 or i > 5) ):
self.row.append(Pool(i * 50, b * 50, self))
else:
self.row.append(GridElement(i * 50, b * 50, self))
if i == 19:
if i == self.x-1:
self.grid.append(list(self.row))
self.row.clear()
@ -75,6 +79,8 @@ class Game(object):
return 'W'
elif object.type == "orderTable":
return 'O'
elif object.type == "pool":
return 'P'
def showGrid(self, grid):
charakterList = []

View File

@ -10,7 +10,7 @@ class OrderTable(object):
self.idOrderTable = game.idOrderTable
self.x = x
self.y = y
self.image = pygame.image.load("./Images/lada.png")
self.image = pygame.image.load("./Images/drewno.jpg")
self.type = "orderTable"
def draw(self):

10
pool.py Normal file
View File

@ -0,0 +1,10 @@
import pygame
from gridElement import GridElement
class Pool(GridElement):
def __init__(self, x=None, y=None, game=None):
GridElement.__init__(self, x, y, game)
self.image = pygame.image.load("./Images/water.jpg")
self.image = pygame.transform.scale(self.image, (50, 50))
self.type = "pool"

View File

@ -18,5 +18,5 @@ class Table(object):
def draw(self):
self.table = pygame.Rect(self.x, self.y, 50, 50)
pygame.draw.rect(self.game.screen, (100, 0, 100,), self.table)
self.game.screen.blit(self.image, (self.x, self.y))
pygame.draw.rect(self.game.screen, (100, 0, 100), self.table)
#self.game.screen.blit(self.image, (self.x, self.y))

View File

@ -9,7 +9,7 @@ class Waiter(object):
self.size= self.game.screen.get_size()
self.x = x
self.y = y
self.image = pygame.image.load("./Images/w1.png").convert()
self.image = pygame.image.load("./Images/waiter.png").convert()
self.image.set_colorkey((255, 255, 255))
self.type = "waiter"
@ -28,7 +28,7 @@ class Waiter(object):
else:
pass
def moveRight(self, game):
if int(game.waiterNumberInGrid.x) != 19:
if int(game.waiterNumberInGrid.x) != game.x-1:
collisionObject = game.grid[int(game.waiterNumberInGrid.y)][int(game.waiterNumberInGrid.x + 1)]
if collisionObject.type == "gridElement":
game.grid[int(game.waiterNumberInGrid.y)][int(game.waiterNumberInGrid.x + 1)].x -= 50
@ -56,7 +56,7 @@ class Waiter(object):
pass
def moveDown(self, game):
if int(game.waiterNumberInGrid.y) != 17:
if int(game.waiterNumberInGrid.y) != game.y-1:
collisionObject = game.grid[int(game.waiterNumberInGrid.y + 1)][int(game.waiterNumberInGrid.x)]
if collisionObject.type == "gridElement":
game.grid[int(game.waiterNumberInGrid.y + 1)][int(game.waiterNumberInGrid.x)].y -= 50
@ -88,4 +88,4 @@ class Waiter(object):
def draw(self):
self.rect1 = pygame.Rect(self.x, self.y, 50, 50)
pygame.draw.rect(self.game.screen, (0, 150, 255), self.rect1)
self.game.screen.blit(self.image, (self.x-50, self.y))
self.game.screen.blit(self.image, (self.x, self.y))