Advertisement
kenadams53

Item object Kens Game

Aug 20th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. # Item class for Kens Game
  2. '''
  3. See pastebin for code:
  4. Kens Game main: https://pastebin.com/NHu4SGA0 # contains a description of the game
  5. Room object: https://pastebin.com/Mn1HecX6
  6. Character object: https://pastebin.com/m6WJQNn5
  7. Item object: https://pastebin.com/GAirfZ5B
  8.  
  9. '''
  10. class Bag(): # Item object Kens game
  11. def __init__(self, bag_name):
  12. self.name = bag_name
  13. self.description = None
  14. self.contents = []
  15.  
  16. def set_description(self, bag_description):
  17. self.description = bag_description
  18.  
  19.  
  20. def get_description(self):
  21. return self.description
  22.  
  23. def get_name(self):
  24. return self.name
  25.  
  26. def set_name(self, bag_name):
  27. self.name = bag_name
  28.  
  29. def describe(self):
  30. #print( self.description )
  31. if len(self.contents)== 0:
  32. print(self.description + " none")
  33. else:
  34. print(self.description)
  35. print(self.contents)
  36.  
  37.  
  38. def get_contents(self):
  39. return self.contents
  40.  
  41.  
  42. def set_contents(self,bag_name):
  43. message = " "
  44. while message != "quit":
  45. message = input("What item do you want to put into the bag? type 'quit' to finish?")
  46. if message != "quit":
  47. self.contents.append(message)
  48.  
  49. #print("completed making object")
  50. ##################333now to make an object####################3
  51. #sports = Bag("sports")
  52. #sports.set_description("\nThe sports bag is large and black with contents:")
  53. #sports.describe()#sports.set_contents("sports")
  54. #sports.describe()
  55. #print(sports.contents)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement