Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- See pastebin for code:
- Kens Game main: https://pastebin.com/NHu4SGA0 # contains description of the game
- Room object: https://pastebin.com/Mn1HecX6
- Character object: https://pastebin.com/m6WJQNn5
- Item object: https://pastebin.com/GAirfZ5B
- '''
- class Room():# Room object for Kens Game
- def __init__(self, room_name):
- self.name = room_name
- self.description = None
- self.linked_rooms = {}
- self.character = None
- def set_description(self, room_description):
- self.description = room_description
- def get_character(self):
- return self.description
- def get_name(self):
- return self.name
- def set_name(self, room_name):
- self.name = room_name
- def describe(self):
- print( self.description )
- def link_room(self, room_to_link, direction):
- self.linked_rooms[direction] = room_to_link
- #print( self.name + " linked rooms :" + repr(self.linked_rooms) )#does not work
- def get_details(self):
- print("\nYou are in the " + self.name)
- self.describe()
- for direction in self.linked_rooms:
- room = self.linked_rooms[direction]
- print( " The " + room.get_name() + " is " + direction)
- def move(self, direction):
- if direction in self.linked_rooms:
- return self.linked_rooms[direction]
- else:
- print("You can't go that way")
- return self
- def set_character(self, character):
- self.character = character
- def get_character(self):
- return self.character
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement