Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###NEW PLAYER CLASS AND HOW I'M IMPLEMENTING IT
- ###Player Class
- class Player():
- def __init__(self,player_name):
- self.name = player_name
- self.health = None
- self.inventory = []
- def set_inventory(self,inventory_list):
- self.inventory = inventory_list
- def get_inventory(self):
- return self.inventory
- def set_health(self,health_points):
- self.health = health_points
- def get_health(self):
- return self.health
- def describe(self):
- print ("You name is, ", self.name)
- print ("You are carrying:")
- for item in self.inventory:
- print (item[0], item[1])
- print ()
- print ("Your health is :", self.health)
- def set_inv_item(self,inv_item):
- self.item = inv_item
- def get_inv_item(self):
- return self.item
- def check_inventory(self,item):
- in_inv = False
- for thing in self.inventory:
- if item in thing[0]:
- in_inv = True
- break
- return in_inv
- #####IMPLEMENMTATION IN MAIN... PARTIAL ONLY!
- elif command =="Give":
- inventory = protag.inventory
- if inhabited is not None:
- give_with= input("What will you give? >>> ")
- protag.set_inv_item = give_with
- in_invent = protag.check_inventory(give_with)
- print (in_invent)
- if in_invent == False:
- print ("You do not have",give_with,"!")
- else:
- if inhabited.hug(give_with):
- print (inhabited.name, "rewards you with",inhabited.reward)
- inventory.append(inhabited.reward)
- else:
- print ("As there is no-one to give to, you wave the",give_with,"in the air")
- print ("It resolves nothing. You quickly tire of this pointless activity.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement