SHARE
TWEET

Untitled

a guest Feb 18th, 2020 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Room():
  2.  
  3.     def __init__(self, room_name):
  4.         self.name = room_name
  5.         self.description = None
  6.         self.linked_rooms = {}
  7.         self.character = None
  8.  
  9.  
  10.     def set_description(self, room_description):
  11.         self.description = room_description
  12.  
  13.     def get_description(self):
  14.         return self.description
  15.  
  16.     def get_name(self):
  17.         return self.name
  18.  
  19.     def set_name(self, room_name):
  20.         self.name = room_name
  21.  
  22.     def describe(self):
  23.         print( self.description )
  24.  
  25.     def link_room(self, room_to_link, direction):
  26.         self.linked_rooms[direction] = room_to_link
  27.         #print( self.name + " linked rooms :" + repr(self.linked_rooms) )
  28.  
  29.     def get_details(self):
  30.         print("Room: "+ self.name)
  31.         print("---------")
  32.         print(self.description)
  33.         for direction in self.linked_rooms:
  34.             room = self.linked_rooms[direction]
  35.             print( "The " + room.get_name() + " is " + direction)
  36.         print("")
  37.  
  38.     def move(self, direction):
  39.         if direction in self.linked_rooms:
  40.             return self.linked_rooms[direction]
  41.         else:
  42.             print("You can't go that way")
  43.         return self
  44.  
  45.     def get_character(self):
  46.         return self.character
  47.  
  48.     def set_character(self, character_name):
  49.         self.character = character_name
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top