Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # character.py
- class Character():
- # Create a character
- def __init__(self, char_name, char_description):
- self.name = char_name
- self.description = char_description
- self.conversation = None
- # Describe this character
- def describe(self):
- print( self.name + " is here!" )
- print( self.description )
- # Set what this character will say when talked to
- def set_conversation(self, conversation):
- self.conversation = conversation
- # Talk to this character
- def talk(self):
- if self.conversation is not None:
- print("[" + self.name + " says]: " + self.conversation)
- else:
- print(self.name + " doesn't want to talk to you")
- # Fight with this character
- def fight(self, combat_item):
- print(self.name + " doesn't want to fight with you and your", combat_item,"!")
- return True
- """
- * Examine the Character class inside character.py to find the name of the method that sets the conversation attribute.
- method = set_conversation, attribute = conversation
- * Add code to your program to call this method and give Dave a line of dialogue.
- See character_test.py dave.talk etc
- * Add code to your program to call a different method that talks to Dave.
- Add to fight dialogue here and and add dave.fight()
- """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement