handle updating location

This commit is contained in:
Joe S 2021-02-26 21:51:34 -05:00
parent 2f8dd761ba
commit a1f215cc93
3 changed files with 21 additions and 13 deletions

View File

@ -34,7 +34,7 @@ class GameNavigator(npyscreen.FormBaseNew):
This may not be needed in the future, dynamic This may not be needed in the future, dynamic
handling of location is something the navigator should do and should inherit from player. handling of location is something the navigator should do and should inherit from player.
""" """
pass self.artBox.footer = location
def create(self): def create(self):
top_division_height = 20 top_division_height = 20
@ -58,7 +58,7 @@ class GameNavigator(npyscreen.FormBaseNew):
editable=False) editable=False)
self.artBox.footer = 'Unknown Location' self.artBox.footer = 'Unknown Location'
self.artBox = self.add(npyscreen.BoxBasic, self.inventoryBox = self.add(npyscreen.BoxBasic,
name='Inventory', name='Inventory',
max_width=inventory_width, max_width=inventory_width,
max_height=top_division_height, 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 its up to Handler.py to actually play the game, but we should
do some basic initalization here do some basic initalization here
""" """
#TODO: load art from the last place the player was in # TODO: load art from the last place the player was in
#TODO: load up inventory # TODO: load up inventory
#TODO: Expand this by loding the text from the game # 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 # 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('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

@ -57,6 +57,12 @@ class Handler(npyscreen.ButtonPress):
# Put the player in a blank room i forgot to finish # Put the player in a blank room i forgot to finish
room = parse(self.parent.parentApp.mainPath / 'gamedata/world/blank_room.yaml') room = parse(self.parent.parentApp.mainPath / 'gamedata/world/blank_room.yaml')
# This sets the footer text in the art window
try:
self.parent.update_location(room['name'])
except KeyError:
self.parent.update_location('Unknown Location')
# By now we should be situated in our room, and with our player. # By now we should be situated in our room, and with our player.
# self.parent.parentApp.log.debug(room) # We dont need to log this, its too verbose! # self.parent.parentApp.log.debug(room) # We dont need to log this, its too verbose!

View File

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