From a1f215cc93f85740e6d4c4a3e30707881322a2b3 Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Fri, 26 Feb 2021 21:51:34 -0500 Subject: [PATCH] handle updating location --- .../adventure_game/GameNavigator.py | 27 ++++++++++--------- Adventure Game/adventure_game/Handler.py | 6 +++++ .../adventure_game/gamedata/world/office.yaml | 1 + 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Adventure Game/adventure_game/GameNavigator.py b/Adventure Game/adventure_game/GameNavigator.py index 9abc7d7..ccf3ba0 100644 --- a/Adventure Game/adventure_game/GameNavigator.py +++ b/Adventure Game/adventure_game/GameNavigator.py @@ -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,13 +58,13 @@ class GameNavigator(npyscreen.FormBaseNew): editable=False) self.artBox.footer = 'Unknown Location' - self.artBox = self.add(npyscreen.BoxBasic, - name='Inventory', - max_width=inventory_width, - max_height=top_division_height, - relx=1, - rely=2, - editable=False) + self.inventoryBox = self.add(npyscreen.BoxBasic, + name='Inventory', + max_width=inventory_width, + max_height=top_division_height, + relx=1, + rely=2, + editable=False) self.logBoxOutline = self.add(npyscreen.BoxBasic, max_width=inventory_width + art_width, @@ -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!') diff --git a/Adventure Game/adventure_game/Handler.py b/Adventure Game/adventure_game/Handler.py index 945bcd4..458780d 100644 --- a/Adventure Game/adventure_game/Handler.py +++ b/Adventure Game/adventure_game/Handler.py @@ -57,6 +57,12 @@ class Handler(npyscreen.ButtonPress): # Put the player in a blank room i forgot to finish 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. # self.parent.parentApp.log.debug(room) # We dont need to log this, its too verbose! diff --git a/Adventure Game/adventure_game/gamedata/world/office.yaml b/Adventure Game/adventure_game/gamedata/world/office.yaml index b0883f1..2848ef4 100644 --- a/Adventure Game/adventure_game/gamedata/world/office.yaml +++ b/Adventure Game/adventure_game/gamedata/world/office.yaml @@ -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|"