From 2f8dd761ba929b7c41b66ff5f938857a1653c6bd Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Fri, 26 Feb 2021 21:46:08 -0500 Subject: [PATCH] player can now change rooms! --- Adventure Game/adventure_game/Player.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Adventure Game/adventure_game/Player.py b/Adventure Game/adventure_game/Player.py index 0c865c9..fb5085d 100644 --- a/Adventure Game/adventure_game/Player.py +++ b/Adventure Game/adventure_game/Player.py @@ -1,10 +1,12 @@ from yaml_parser import parse_datafile as parse + class Player: """ This class intended to abstract out the actual yaml data into a player.(item) that is more friendly to handle in code. """ + def __init__(self, save_location): self.save_location = save_location @@ -15,4 +17,8 @@ class Player: 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 + self.playerData['player']['location'] = new_room + + room = self.playerData['player']['location'] + + return parse('adventure_game/gamedata/world/' + room)['room']['upon_enter']