Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Item class for Kens Game
- '''
- See pastebin for code:
- Kens Game main: https://pastebin.com/NHu4SGA0 # contains a description of the game
- Room object: https://pastebin.com/Mn1HecX6
- Character object: https://pastebin.com/m6WJQNn5
- Item object: https://pastebin.com/GAirfZ5B
- '''
- class Bag(): # Item object Kens game
- def __init__(self, bag_name):
- self.name = bag_name
- self.description = None
- self.contents = []
- def set_description(self, bag_description):
- self.description = bag_description
- def get_description(self):
- return self.description
- def get_name(self):
- return self.name
- def set_name(self, bag_name):
- self.name = bag_name
- def describe(self):
- #print( self.description )
- if len(self.contents)== 0:
- print(self.description + " none")
- else:
- print(self.description)
- print(self.contents)
- def get_contents(self):
- return self.contents
- def set_contents(self,bag_name):
- message = " "
- while message != "quit":
- message = input("What item do you want to put into the bag? type 'quit' to finish?")
- if message != "quit":
- self.contents.append(message)
- #print("completed making object")
- ##################333now to make an object####################3
- #sports = Bag("sports")
- #sports.set_description("\nThe sports bag is large and black with contents:")
- #sports.describe()#sports.set_contents("sports")
- #sports.describe()
- #print(sports.contents)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement