Renames 'void' element by 'floor'
This commit is contained in:
parent
80c22b9685
commit
5a7224aaad
2
conf.py
2
conf.py
|
@ -17,7 +17,7 @@ ELEMENTS = (
|
|||
'tile': 'img/ether.png'},
|
||||
{'symbol': 'E', 'name': 'exit', 'cross': False, 'item': False,
|
||||
'tile': 'img/guardian.png'},
|
||||
{'symbol': ' ', 'name': 'void', 'cross': True, 'item': False,
|
||||
{'symbol': ' ', 'name': 'floor', 'cross': True, 'item': False,
|
||||
'tile': 'img/floor1.png'},
|
||||
{'symbol': '.', 'name': 'wall', 'cross': False, 'item': False,
|
||||
'tile': 'img/wall.png'},
|
||||
|
|
6
maze.py
6
maze.py
|
@ -51,7 +51,7 @@ class Maze:
|
|||
for symbol_to_place in elmt_val('symbol', 'item', True):
|
||||
position = random.choice(
|
||||
[idx for (idx, value) in enumerate(self.string)
|
||||
if value == elmt_val('symbol', 'name', 'void', 0)]
|
||||
if value == elmt_val('symbol', 'name', 'floor', 0)]
|
||||
)
|
||||
|
||||
self.set_symbol(symbol_to_place, position)
|
||||
|
@ -91,7 +91,7 @@ class Maze:
|
|||
if differance < 0:
|
||||
return line[:MAZE_SIZE]
|
||||
elif differance > 0:
|
||||
return line + (differance * elmt_val('symbol', 'name', 'void', 0))
|
||||
return line + (differance * elmt_val('symbol', 'name', 'floor', 0))
|
||||
else:
|
||||
return line
|
||||
|
||||
|
@ -99,7 +99,7 @@ class Maze:
|
|||
"""
|
||||
Set an symbol on the maze
|
||||
|
||||
Used for 'player' and 'void' after collecting items
|
||||
Used for 'player' and 'floor' after collecting items
|
||||
|
||||
:param str symbol: the symbol to set
|
||||
:param str pos: index in the string
|
||||
|
|
10
player.py
10
player.py
|
@ -23,8 +23,8 @@ class Player:
|
|||
self.position = maze.string.find(
|
||||
elmt_val('symbol', 'name', 'player', 0)
|
||||
)
|
||||
# Element under player, default 'void'
|
||||
self.ground = elmt_val('symbol', 'name', 'void', 0)
|
||||
# Element under player, default 'floor'
|
||||
self.ground = elmt_val('symbol', 'name', 'floor', 0)
|
||||
|
||||
self.stock = []
|
||||
self.stock_num = 0
|
||||
|
@ -77,15 +77,15 @@ class Player:
|
|||
if next_position in self.maze.RANGE:
|
||||
next_symbol = self.maze.string[next_position]
|
||||
|
||||
# is a 'void' element
|
||||
if next_symbol == elmt_val('symbol', 'name', 'void', 0):
|
||||
# is a 'floor' element
|
||||
if next_symbol == elmt_val('symbol', 'name', 'floor', 0):
|
||||
self.position = next_position
|
||||
self.status_message['status'] = MSG_OK
|
||||
|
||||
# is a 'item' element
|
||||
elif next_symbol in elmt_val('symbol', 'item', True):
|
||||
self.position = next_position
|
||||
self.ground = elmt_val('symbol', 'name', 'void', 0)
|
||||
self.ground = elmt_val('symbol', 'name', 'floor', 0)
|
||||
self.stock.append(
|
||||
elmt_val('name', 'symbol', next_symbol, 0)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue