Collects items in a list
TODO draws items counter and message TODO checks if all items is collected before exiting TODO move maze_draw() to func.py
This commit is contained in:
parent
f021ab5fa2
commit
a937a79719
|
@ -50,7 +50,7 @@ guard without all the objects, he dies (according to the evolution theory).
|
|||
when he arrives in front of the goalkeeper
|
||||
3. Recovering objects
|
||||
* [x] Add object management
|
||||
* [ ] The way he pick them up
|
||||
* [x] The way he pick them up
|
||||
* [ ] Add a counter that will list them.
|
||||
4. Win!
|
||||
* [ ] _McGyver_ has picked up all the objects and asleep the guard
|
||||
|
|
4
conf.py
4
conf.py
|
@ -19,12 +19,12 @@ ELEMENT_LIST = [
|
|||
]
|
||||
|
||||
# Possible returns of a move, keep the «ok» at the end
|
||||
MOVE_STATUS = ['bad', 'wall', 'exit', 'door', 'ok']
|
||||
MOVE_STATUS = ['bad', 'wall', 'exit', 'collect', 'ok']
|
||||
MOVE_STATUS_MSG = {
|
||||
'bad': "Le déplacement «{}» n'est pas autorisé.",
|
||||
'wall': "Le déplacement est stoppé par un mur.",
|
||||
'exit': "Vous êtes sortit du labyrinte",
|
||||
'door': "Vous passez une porte",
|
||||
'collect': "Vous ramassez l'objet «{}»",
|
||||
'ok': "Jusqu'ici, tout va bien…"
|
||||
}
|
||||
|
||||
|
|
9
map.py
9
map.py
|
@ -68,6 +68,7 @@ class Map:
|
|||
|
||||
self.status = True
|
||||
self.status_message = MSG_START_GAME
|
||||
self.collected_items = []
|
||||
|
||||
else:
|
||||
self.status = False
|
||||
|
@ -120,6 +121,12 @@ class Map:
|
|||
self._player_position = next_position
|
||||
self.status_message = MOVE_STATUS_MSG['ok']
|
||||
|
||||
elif next_char in elmt_val('symbol', 'collect', True):
|
||||
self._player_position = next_position
|
||||
self.status_message = MOVE_STATUS_MSG['collect'].format(elmt_val('name', 'symbol', next_char, 0))
|
||||
self._element_under_player = elmt_val('symbol', 'name', 'void', 0)
|
||||
self.collected_items.append(elmt_val('name', 'symbol', next_char, 0))
|
||||
|
||||
elif next_char == elmt_val('symbol', 'name', 'exit', 0):
|
||||
self._player_position = next_position
|
||||
self.status = False
|
||||
|
@ -133,7 +140,7 @@ class Map:
|
|||
# place le plyr sur sa nouvelle position
|
||||
self.place_element(elmt_val('symbol', 'name', 'player', 0))
|
||||
# Debug
|
||||
self.status_message += "|"+str(self._player_position)+"|"+str(self._MAXIM)
|
||||
self.status_message += "|"+str(self.collected_items)
|
||||
|
||||
def place_element(self, element, **kwargs):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue