diff --git a/resources/simulations/simulation_1.txt b/resources/simulations/simulation_1.txt new file mode 100644 index 0000000..5f31389 --- /dev/null +++ b/resources/simulations/simulation_1.txt @@ -0,0 +1,15 @@ +______________ +______________ +__KW_____KW___ +_KSWK___KSWK__ +__KWS____KWSK_ +__KWK____KWK__ +_KSW____KSW___ +__KWK____KWK__ +__KWS____KWSK_ +_KSWK___KSWK__ +__KW_____KW___ +______________ +______________ +BBBBB_________ +____B_________ \ No newline at end of file diff --git a/resources/simulations/simulation_2.txt b/resources/simulations/simulation_2.txt new file mode 100644 index 0000000..b271377 --- /dev/null +++ b/resources/simulations/simulation_2.txt @@ -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 \ No newline at end of file diff --git a/resources/simulations/simulation_3.txt b/resources/simulations/simulation_3.txt new file mode 100644 index 0000000..69bc73e --- /dev/null +++ b/resources/simulations/simulation_3.txt @@ -0,0 +1,2 @@ +__X +___ \ No newline at end of file diff --git a/src/graphics.py b/src/graphics.py index 3210f72..60e0334 100644 --- a/src/graphics.py +++ b/src/graphics.py @@ -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 diff --git a/src/matrix.py b/src/matrix.py index af8d07c..0dee0b9 100644 --- a/src/matrix.py +++ b/src/matrix.py @@ -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]) \ No newline at end of file diff --git a/src/tile.py b/src/tile.py index c63e8aa..ffd5332 100644 --- a/src/tile.py +++ b/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 +