Txemin

room

May 26th, 2019
1,328
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Room():
  2. def __init__(self, room_name):
  3. self.name = room_name
  4. self.description = None
  5. self.linked_rooms = {}
  6. self.character = None
  7.  
  8. def set_description(self, room_description):
  9. self.description = room_description
  10.  
  11. def get_description(self):
  12. return self.description
  13.  
  14. def set_name(self, room_name):
  15. self.name = room_name
  16.  
  17. def get_name(self):
  18. return self.name
  19.  
  20. def set_character(self):
  21. self.character = char_name
  22.  
  23. def get_character(self):
  24. return self.character
  25.  
  26. def describe(self, description):
  27. print(self.description)
  28.  
  29. def linked_room(self, room_to_link, direction):
  30. self.linked_rooms[direction] = room_to_link
  31. # print(self.name + " linked room " + repr(self.linked_rooms))
  32.  
  33. def get_details(self):
  34. print ("\n The " + self.name + " is a " + self.description)
  35. for direction in self.linked_rooms:
  36. room = self.linked_rooms[direction]
  37. print( "The " + room.get_name() + " is " + direction)
  38.  
  39. def move(self, direction):
  40. if direction in self.linked_rooms:
  41. return self.linked_rooms[direction]
  42. else:
  43. print("You can't go that way")
  44. return self
RAW Paste Data