diff --git a/Adventure Game/adventure_game/GameNavigator.py b/Adventure Game/adventure_game/GameNavigator.py index b986b47..9abc7d7 100644 --- a/Adventure Game/adventure_game/GameNavigator.py +++ b/Adventure Game/adventure_game/GameNavigator.py @@ -29,6 +29,13 @@ class GameNavigator(npyscreen.FormBaseNew): self.logBox.value = res # Set the logbox to that value + def update_location(self, location): + """ + This may not be needed in the future, dynamic + handling of location is something the navigator should do and should inherit from player. + """ + pass + def create(self): top_division_height = 20 inventory_width = 20 diff --git a/Adventure Game/adventure_game/Handler.py b/Adventure Game/adventure_game/Handler.py index b8e02c4..eb28edd 100644 --- a/Adventure Game/adventure_game/Handler.py +++ b/Adventure Game/adventure_game/Handler.py @@ -92,6 +92,17 @@ class Handler(npyscreen.ButtonPress): self.parent.update_log(room[long_arg.lower()]['pick_up']) except KeyError: self.parent.update_log("You cant pick that up.") + + elif command == 'OPEN': + 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)) + 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)) self.parent.update_log('I didn\'t understand {0}'.format(command)) diff --git a/Adventure Game/adventure_game/Player.py b/Adventure Game/adventure_game/Player.py index b27cb37..0c865c9 100644 --- a/Adventure Game/adventure_game/Player.py +++ b/Adventure Game/adventure_game/Player.py @@ -8,4 +8,11 @@ class Player: def __init__(self, save_location): self.save_location = save_location - self.playerData = parse(save_location) \ No newline at end of file + self.playerData = parse(save_location) + + def change_room(self, new_room): + """ + Should move the player to a new room + TODO: Put a check here that checks if the room we're moving to exists! + """ + self.playerData['player']['location'] = new_room \ No newline at end of file