Compare commits

..

3 Commits

Author SHA1 Message Date
Joe S 493b663b4e Must handle these 2021-02-26 21:54:59 -05:00
Joe S 21bd3c39bb Change where we set art, inventory and location 2021-02-26 21:53:41 -05:00
Joe S a1f215cc93 handle updating location 2021-02-26 21:51:34 -05:00
3 changed files with 34 additions and 23 deletions

View File

@ -34,7 +34,7 @@ class GameNavigator(npyscreen.FormBaseNew):
This may not be needed in the future, dynamic
handling of location is something the navigator should do and should inherit from player.
"""
pass
self.artBox.footer = location
def create(self):
top_division_height = 20
@ -58,7 +58,7 @@ class GameNavigator(npyscreen.FormBaseNew):
editable=False)
self.artBox.footer = 'Unknown Location'
self.artBox = self.add(npyscreen.BoxBasic,
self.inventoryBox = self.add(npyscreen.BoxBasic,
name='Inventory',
max_width=inventory_width,
max_height=top_division_height,
@ -108,10 +108,11 @@ class GameNavigator(npyscreen.FormBaseNew):
its up to Handler.py to actually play the game, but we should
do some basic initalization here
"""
#TODO: load art from the last place the player was in
#TODO: load up inventory
# TODO: load art from the last place the player was in
# TODO: load up inventory
#TODO: Expand this by loding the text from the game
#WARN: THIS MAY REQUIRE REWRITING HANDLER.PY TO INTALIZE THE ROOM OBJECT OUTSIDE OF HANDLER.PY
# TODO: Expand this by loding the text from the game
# WARN: THIS MAY REQUIRE REWRITING HANDLER.PY TO INTALIZE THE ROOM OBJECT OUTSIDE OF HANDLER.PY
self.update_log('Welcome back! Try "LOOK AROUND" to get started.')
self.update_log('>>Note from joe: Welcome! you\'re playing the demo! Please dont mind text issues like |this| and *this*\ni have yet to implement color!')
self.update_log(
'>>Note from joe: Welcome! you\'re playing the demo! Please dont mind text issues like |this| and *this*\ni have yet to implement color!')

View File

@ -101,16 +101,16 @@ class Handler(npyscreen.ButtonPress):
self.parent.update_log("You must specify something to pick up.")
elif command == 'OPEN':
#try:
try:
self.parent.parentApp.log.info('Player tried to open door: {0}'.format(arguments[0]))
new_room = room[arguments[0].lower()]['leads_to']
self.parent.parentApp.log.debug('New room is: {0}'.format(new_room))
upon_enter = player.change_room(new_room) # Change the player to that new room.
self.parent.update_log(upon_enter) # Print the new room upon enter text.
#except KeyError:
# self.parent.update_log("You cant open that.")
#except IndexError:
# self.parent.update_log("you must specify something to open")
except KeyError:
self.parent.update_log("You cant open that.")
except IndexError:
self.parent.update_log("you must specify something to open")
else:
self.parent.parentApp.log.info('Player\'s command was not understood: {0}'.format(command))
@ -123,6 +123,15 @@ class Handler(npyscreen.ButtonPress):
# Log the command that we parsed
self.parent.parentApp.log.info('Parsed command "{0}" with arguments "{1}"'.format(command, arguments))
"""
Do a little bit of final setup, change the art if we
need to, change the text at the bottom and update the inventory.
"""
try:
self.parent.update_location(room['name'])
except KeyError:
self.parent.update_location('Unknown Location')
# Make sure to re-draw the art box when we're all done (in case we updated it in logic above)
self.parent.artContent.display()

View File

@ -1,4 +1,5 @@
room:
name: "Your Office"
grid: [0, 0]
upon_enter: "You are standing behind your desk, you see a |NAMEPLATE|, a |TAPE RECORDER| and your trusty |LOG VIEWER|"
look_around: "You look around the room, you see a |DESK|, a |BOOKSHELF| and the |DOOR|"