Advertisement
chrisCNG

roomDojo1end

Nov 18th, 2019
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.11 KB | None | 0 0
  1. # room Class Part1end
  2. class Room():
  3.     def __init__(self, room_name):
  4.         self.name = room_name
  5.         self.description = None
  6.         self.linked_rooms = {}
  7.  
  8.     def set_description(self, room_description):
  9.         self.description = room_description
  10.  
  11.     def get_name(self):
  12.         return self.name
  13.  
  14.     def set_name(self, room_name):
  15.         self.name = room_name
  16.  
  17.     def describe(self):
  18.         print( self.description )
  19.  
  20.     def link_room(self, room_to_link, direction):
  21.         self.linked_rooms[direction] = room_to_link
  22.        
  23.     def get_details(self):
  24.         print(" ")
  25.         print("The " + self.name)
  26.         print("--------------------------")
  27.         print(self.description)
  28.         print(" ")
  29.         for direction in self.linked_rooms:
  30.             room = self.linked_rooms[direction]
  31.             print( "The " + room.get_name() + " is " + direction)
  32.            
  33.     def move(self, direction):
  34.         if direction in self.linked_rooms:
  35.             return self.linked_rooms[direction]
  36.         else:
  37.             print("You can't go that way")
  38.             return self
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement