player can now change rooms!

This commit is contained in:
Joe S 2021-02-26 21:46:08 -05:00
parent bcb2ee060d
commit 2f8dd761ba
1 changed files with 7 additions and 1 deletions

View File

@ -1,10 +1,12 @@
from yaml_parser import parse_datafile as parse from yaml_parser import parse_datafile as parse
class Player: class Player:
""" """
This class intended to abstract out the actual yaml data into a player.(item) that is more This class intended to abstract out the actual yaml data into a player.(item) that is more
friendly to handle in code. friendly to handle in code.
""" """
def __init__(self, save_location): def __init__(self, save_location):
self.save_location = save_location self.save_location = save_location
@ -15,4 +17,8 @@ class Player:
Should move the player to a 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! TODO: Put a check here that checks if the room we're moving to exists!
""" """
self.playerData['player']['location'] = new_room self.playerData['player']['location'] = new_room
room = self.playerData['player']['location']
return parse('adventure_game/gamedata/world/' + room)['room']['upon_enter']