Set default restaurant, txt interpreter
This commit is contained in:
parent
80410b8438
commit
7660f83334
15
resources/simulations/simulation_1.txt
Normal file
15
resources/simulations/simulation_1.txt
Normal file
@ -0,0 +1,15 @@
|
||||
______________
|
||||
______________
|
||||
__KW_____KW___
|
||||
_KSWK___KSWK__
|
||||
__KWS____KWSK_
|
||||
__KWK____KWK__
|
||||
_KSW____KSW___
|
||||
__KWK____KWK__
|
||||
__KWS____KWSK_
|
||||
_KSWK___KSWK__
|
||||
__KW_____KW___
|
||||
______________
|
||||
______________
|
||||
BBBBB_________
|
||||
____B_________
|
8
resources/simulations/simulation_2.txt
Normal file
8
resources/simulations/simulation_2.txt
Normal file
@ -0,0 +1,8 @@
|
||||
X___TXFX
|
||||
T_X_X__X
|
||||
X_X_X_XX
|
||||
T_X____T
|
||||
X_X_XX_X
|
||||
X_X____T
|
||||
T_X_XXXX
|
||||
XXX____W
|
2
resources/simulations/simulation_3.txt
Normal file
2
resources/simulations/simulation_3.txt
Normal file
@ -0,0 +1,2 @@
|
||||
__X
|
||||
___
|
@ -5,10 +5,17 @@ class Graphics:
|
||||
def __init__(self):
|
||||
self.image = {
|
||||
'floor': pygame.image.load('../resources/images/floor.jpg'),
|
||||
'table': pygame.image.load('../resources/images/table.png'),
|
||||
'wall': pygame.image.load('../resources/images/table3.png'), #
|
||||
'bar': pygame.image.load('../resources/images/table3.png'), #
|
||||
'table': pygame.image.load('../resources/images/table3.png'),
|
||||
'waiter': pygame.image.load('../resources/images/waiter.png'),
|
||||
'table2': pygame.image.load('../resources/images/table2.png'),
|
||||
'table3': pygame.image.load('../resources/images/table3.png')
|
||||
'table3': pygame.image.load('../resources/images/table3.png'),
|
||||
'chair': pygame.image.load('../resources/images/table3.png'),
|
||||
'chair_up': pygame.image.load('../resources/images/table3.png'), #
|
||||
'chair_down': pygame.image.load('../resources/images/table3.png'), #
|
||||
'chair_left': pygame.image.load('../resources/images/table3.png'), #
|
||||
'chair_right': pygame.image.load('../resources/images/table3.png') #
|
||||
}
|
||||
self.block_size = 50
|
||||
self.height = 15
|
||||
|
@ -9,12 +9,28 @@ class Matrix:
|
||||
|
||||
for x in range(14):
|
||||
for y in range(15):
|
||||
self.matrix[x][y] = Tile(type_='floor', watch_through=1)
|
||||
self.matrix[1][0].type = 'table3'
|
||||
self.matrix[1][0].walk_through = 0
|
||||
self.matrix[x][y] = Tile(type_='floor')
|
||||
self.set_default_restaurant()
|
||||
|
||||
def get_type(self, x, y):
|
||||
return self.matrix[x][y].type
|
||||
|
||||
def walk_through(self, x, y):
|
||||
return self.matrix[x][y].walk_through
|
||||
|
||||
def set_default_restaurant(self):
|
||||
symbols = {
|
||||
'W': 'waiter',
|
||||
'S': 'table',
|
||||
'B': 'bar',
|
||||
'X': 'wall',
|
||||
'K': 'chair',
|
||||
'_': 'floor'
|
||||
}
|
||||
|
||||
lines = [line.rstrip('\n') for line in open('../resources/simulations/simulation_1.txt')]
|
||||
|
||||
for row in range(14):
|
||||
for column in range(15):
|
||||
sign = lines[column][row]
|
||||
self.matrix[row][column] = Tile(symbols[sign])
|
15
src/tile.py
15
src/tile.py
@ -1,7 +1,14 @@
|
||||
# TILE
|
||||
class Tile:
|
||||
def __init__(self, type_, watch_through):
|
||||
self.watch_through = watch_through
|
||||
self.walk_through = 1
|
||||
self.action_required = 0
|
||||
def __init__(self, type_):
|
||||
self.type = type_
|
||||
|
||||
if self.type == 'table' or self.type == 'wall' or self.type == 'bar':
|
||||
self.watch_through = 1
|
||||
self.walk_through = 0
|
||||
else:
|
||||
self.watch_through = 1
|
||||
self.walk_through = 1
|
||||
|
||||
self.action_required = 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user