from character import Enemy dave = Enemy("Dave", "A smelly zombie") dave.describe() dave.talk() dave.set_conversation("AGGGGHHHHH") dave.talk() dave.set_weakness("cheese") print("What will you fight with?") fight_with = input() dave.fight(fight_with)
from character import Enemy dave = Enemy("Dave", "A smelly zombie") dave.describe() dave.set_conversation("Hi.") dave.talk() dave.set_weakness("Hammer") print("What will you fight with?") fight_with = input("> ") dave.fight(fight_with)
from room import Room from item import Item from helpMe import HelpMe from character import Enemy from character import Friend myhelp = HelpMe() myhelp.helpMe() dave = Enemy("Dave", "A smelly zombie") dave.set_conversation("I am a a zomilator") dave.set_weakness("cheese") mary = Friend("Mary", "A nice person") mary.set_conversation("I like hugs") #dave.set_weakness("cheese") # create rooms kitchen = Room("Kitchen") kitchen.set_description("A dank and dirty room buzzing with flies.") kitchen.set_character(mary) dining_hall = Room("Dining Hall") dining_hall.set_description( "A large room with ornate golden decorations on each wall.") #put an enemy in the room dining_hall.set_character(dave) ballroom = Room("Ballroom") ballroom.set_description( "A vast room with a shiny wooden floor. Huge candlesticks guard the entrance."
from character import Character, Enemy dave = Enemy("Dave", "A smelly zombie") dave.describe() # Add some conversation for Dave when he is talked to dave.set_conversation("I want your brains!") # Trigger a conversation with Dave dave.talk() dave.set_weakness("water") print("What will you fight with?") fight_with = input() dave.fight(fight_with)
from character import Enemy dave = Enemy("dave", "a smelly zombie") davi = Enemy("davi", "another smelly zombie") dave.describe() davi.describe() dave.set_conversation("hey") davi.set_conversation("what weapon have you got?") dave.talk() davi.talk() dave.set_weakness("sword") print("What will you fight with?") fight_with = input() dave.fight(fight_with) davi.set_weakness("gun") print("okay, but what will you fight me with?") fight_with = input() davi.fight(fight_with)
kitchen = Room("Kitchen") kitchen.set_description("A dank and dirty room buzzing with flies.") dining_hall = Room("Dining Hall") dining_hall.set_description("A large room with ornate golden decorations on each wall.") ballroom = Room("Ballroom") ballroom.set_description("A vast room with a shiny wooden floor. Huge candlesticks guard the entrance.") kitchen.link_room(dining_hall, "south") dining_hall.link_room(kitchen, "north") dining_hall.link_room(ballroom, "west") ballroom.link_room(dining_hall, "east") dave = Enemy("Dave", "A smelly zombie") dave.set_conversation("aaaaaghhh") dave.set_weakness("cheese") dining_hall.set_character(dave) catrina = Friend("Catrina", "A friendly skeleton") catrina.set_conversation("Why hello there.") ballroom.set_character(catrina) current_room = kitchen dead = False while dead == False: print("\n") current_room.get_details()
bedroom = Room("Bedroom") bedroom.set_description( "A cozy but spooky place to rest with skeletons on the bed") print("There are " + str(Room.number_of_rooms) + " rooms to explore.") kitchen.link_room(dining_hall, "south") dining_hall.link_room(kitchen, "north") dining_hall.link_room(ballroom, "west") dining_hall.link_room(bedroom, "east") ballroom.link_room(dining_hall, "east") bedroom.link_room(dining_hall, "west") dave = Enemy("Dave", "A smelly zombie") dave.set_conversation("Brrlgrh... rgrhl... brains...") dave.set_weakness("gun") dining_hall.set_character(dave) davi = Enemy("Davi", "Another smelly zombie") davi.set_conversation("Brrlgrh...urgghh..wanna dance?..") davi.set_weakness("water") bedroom.set_character(davi) catrina = Friend("Catrina", "A friendly skeleton") catrina.set_conversation("Why hello there.") ballroom.set_character(catrina) glasses = Item("glasses") glasses.set_description("A pair of old glasses") ballroom.set_item(glasses)
from character import Character from character import Enemy dave = Enemy("Dave", "A smelly Zombie!", "Talk to ME") dave.describe() person = Character("User", "just a person", "...") dave.talk() dave.set_conversation("I don't smell THAT Bad do I...?") dave.talk() person.talk() dave.set_conversation("...[glare]") dave.talk() person.set_conversation("Not That... Bad... But yeah not good :(") person.talk() dave.set_conversation("[Cries], leave me alone now") dave.talk() person.set_conversation("Sorry but I think its time to FIGHT!!!!") person.talk() dave.set_weakness("silver knife") print("What will you fight with?") fight_with = input() dave.fight(fight_with)
path_pick = Room_Command('pick', 'You pick some flowers and try and put them in your bacpack') stream_swim = Room_Command('swim', 'You take a refreshing dip in the stream') stream_pick = Room_Command('pick', 'You pick some flowers, although they wilt in your hand as you pick them') herb_garden_pick = Room_Command('pick', 'You pick some herbs and try and put them in your bacpack') path.set_special(path_climb) path.set_special(path_pick) stream.set_special(stream_swim) stream2.set_special(stream_swim) stream.set_special(stream_pick) stream2.set_special(stream_pick) herb_garden.set_special(herb_garden_pick) # Enemies dave = Enemy('Dave', 'A smelly grumpy zombie') dave.set_conversation('Brrlgrh... rgrhl... brains...') dave.set_weakness('cheese') jack = Enemy('Jack', 'An enormous fierce rat') jack.set_conversation('And a fine day it is') jack.set_weakness('book') jill = Enemy('Jill', 'A nasty troll') jill.set_conversation('How much will you pay me to cross the bridge?') jill.set_weakness('duster') # Friends connie = Friend('Connie', 'A friendly skelton') connie.set_conversation('How are you today?') connie.set_hint('Dave doesn\'t like cheese.')
dining_hall.link_room(ballroom, "west") cheese = Item("cheese") cheese.set_description("A stinky block of cheese") kitchen.set_item(cheese) tiara = Item("tirara") tiara.set_description("A shiny head piece suitable for a princess") ballroom.set_item(tiara) tennis = Item("tennis") tennis.set_description("A furry greeinsh round thing") dining_hall.set_item(tennis) dave = Enemy("Dave", "A smelly zombie") dave.set_conversation("I eat your brains") dave.set_weakness("cheese") dining_hall.set_character(dave) baxter = Enemy("Baxter", "A rabid wild dog beast") baxter.set_conversation("Woof Woof") baxter.set_weakness("tennis") kitchen.set_character(baxter) claire = Friend("Claire", "A sexy ghost who loves you") claire.set_conversation("Come and give me a great big hug") claire.set_strength("bff") ballroom.set_character(claire) dead = False current_room = kitchen
kitchen.set_description("A dank and dirty room buzzing with flies.") dining_hall = Room('Dining Hall') dining_hall.set_description( "A large room with ornate golden decorations on each wall") ballroom = Room("Ballroom") ballroom.set_description("A vast room with a shiny floor.") kitchen.link_room(dining_hall, "south") dining_hall.link_room(kitchen, "north") ballroom.link_room(dining_hall, "east") dining_hall.link_room(ballroom, "west") dave = Enemy("Dave", "A smelly zombie") dave.set_conversation("Braiiiinnnnns") dave.set_weakness("cheese") laura = Friend( "Laura", "Laura creates and maintains Raspberry Pi educational resources. Aside from computers, she loves cats, cakes, board games and making jam." ) laura.set_conversation("Sorry, did you somehow put me inside your game?") laura.favorites = [ "computer", "computers", "cats", "cat", "cake", "cakes", "board game", "board games" ] cheese = Item("cheese") cheese.set_description("This is a wedge of cheese.")
kitchen.set_description('a place to cook food') dining_hall = Room('Dining Hall') dining_hall.set_description('a place where people eat') ball_room = Room('Ballroom') ball_room.set_description('a place where people dance') kitchen.link_room(dining_hall, 'south') dining_hall.link_room(kitchen, 'north') dining_hall.link_room(ball_room, 'west') ball_room.link_room(dining_hall, 'east') cheese = Item('cheese') dave = Enemy("dave", "a smelly zombie") dave.set_conversation('ill eat your brains!') dave.set_weakness('cheese') dining_hall.set_character(dave) dining_hall.set_item(cheese) cheese.set_description('a big smelly block of cheese') current_room = kitchen dead = False while dead == False: print("\n") current_room.get_details() inhabitant = current_room.get_character() if inhabitant is not None: inhabitant.describe()
from character import Character from character import Enemy dave=Enemy('Dave','He seems to be a weird guy.') dave.describe() dave.set_conversation('Hi, my name is Inigo Montoya. You killed my father. Prepare to die.') dave.talk() dave.set_weakness("cheese") print("What will you fight with ?") item_chosen=input() dave.fight(item_chosen)
kitchen.set_description("A dank and dirty room buzzing with flies.") dining_hall = Room("Dining Hall") dining_hall.set_description( "A large room with ornate golden decorations on each wall.") ballroom = Room("Ballroom") ballroom.set_description( "A vast room with a shiny wooden floor. Huge candlesticks guard the entrance." ) kitchen.link_room(dining_hall, "s") dining_hall.link_room(kitchen, "n") dining_hall.link_room(ballroom, "w") ballroom.link_room(dining_hall, "e") vlad = Enemy("Vlad", "A scary vampire") vlad.set_conversation("I'm always looking for my necks victim!") vlad.set_weakness("stake") dave = Enemy("Dave", "A smelly zombie") dave.set_conversation("Brrlgrh... Rgrhl... Braaaaains!") dave.set_weakness("bat") catrina = Friend("Catrina", "A friendly skeleton") catrina.set_conversation("Konnichiwa!") kitchen.set_character(vlad) dining_hall.set_character(dave) ballroom.set_character(catrina) bat = Item("bat", "A solid looking cricket bat") stake = Item("stake", "A wooden stake, sharpened at one end")
dining_hall = Room("Dining Hall") dining_hall.set_description( "A large room with ornate golden decorations on each wall.") ballroom = Room("Ballroom") ballroom.set_description( "A vast room with a shiny wooden floor. Huge candlesticks guard the entrance." ) kitchen.link_room(dining_hall, "south") dining_hall.link_room(kitchen, "north") dining_hall.link_room(ballroom, "west") ballroom.link_room(dining_hall, "east") dave = Enemy("Dave", "A smelly zombie") dave.set_conversation("What's up, dude! I'm hungry.") dave.set_weakness("cheese") dining_hall.set_character(dave) tabitha = Enemy("Tabitha", "An enormous spider with countless eyes and furry legs.") tabitha.set_conversation("Sssss....I'm so bored...") tabitha.set_weakness("book") ballroom.set_character(tabitha) cheese = Item("cheese") cheese.set_description("A large and smelly block of cheese") ballroom.set_item(cheese) book = Item("book") book.set_description("A really good book entitled 'Knitting for dummies'")
"A large room with ornate golden decorations on each wall.") ballroom = Room("Ballroom") ballroom.set_description( "A vast room with a shiny wooden floor. Huge candlesticks guard the entrance." ) kitchen.link_room(dining_hall, "south") dining_hall.link_room(kitchen, "north") dining_hall.link_room(ballroom, "west") ballroom.link_room(dining_hall, "east") dave = Enemy("Dave", "A smelly zombie") # Add some conversation for Dave when he is talked to dave.set_conversation("What's up, dude!") dave.set_weakness("cheese") dining_hall.set_character(dave) # Add a new character catrina = Friend("Catrina", "A friendly skeleton") catrina.set_conversation("Why hello there.") ballroom.set_character(catrina) current_room = kitchen dead = False
kitchen.set_description ("A dank and dirty room buzzing with flies.") dining_hall=Room ("dining_hall") dining_hall.set_description ("A big and clean dining hall") ballroom=Room ("ballroom") ballroom.set_description ("An empty and huge ballroom") kitchen.link_room(dining_hall, "south") dining_hall.link_room (ballroom, "east") ballroom.link_room (kitchen,"north") dave=Enemy ("Dave", "A smelly zombie") dave.describe() dave.set_conversation ("What's up dude?") dave.talk() dave.set_weakness ("cheese") print ("what will you fight with?") fight_with=input() dave.fight (fight_with) dining_hall.set_character(dave) greeny = Enemy ("Greeny", " A big messy worm") greeny.set_conversation ("Ajj, I'm so ugly") greeny.set_weakness ("teddy") ballroom.set_character (greeny) cheese = Item ("cheese") cheese.set_description ("A big and smelly bloch of cheese")
from character import Enemy dave = Enemy("Dave", "A smelly zombie!") dave.describe() dave.set_conversation("Hello ... I'm hungry, come here!") dave.talk() dave.set_weakness("cheese") print("What will you fight with?") fight_with = input() dave.fight(fight_with)
from character import Enemy sid = Enemy('sid','demon from hell') sid.describe() sid.set_conversation("I lurk in the darkness") sid.talk() sid.set_weakness('light') sid.get_weakness() x = input() sid.fight(x)
from character import Enemy dave = Enemy("Dave", "A smelly zombie") dave.set_weakness("cheese") dave.describe() dave.set_conversation("Give me your brains!!!") dave.talk() print("What will you fight with?") fight_with = input() dave.fight(fight_with)
kitchen.set_description("A dank and dirty room buzzing with flies.") dining_hall = Room("Dining Hall") dining_hall.set_description( "A large room with ornate golden decorations on every wall") ballroom = Room("Ballroom") ballroom.set_description("A vast room with shiny decorations") kitchen.link_room(dining_hall, "south") dining_hall.link_room(kitchen, "north") dining_hall.link_room(ballroom, "west") ballroom.link_room(dining_hall, "east") dave = Enemy("Dave", "A smelly zombie") dave.set_conversation("Brrlgrh... rgrhl... brains...") dave.set_weakness("cheese") dining_hall.set_character(dave) catrina = Friend("Catrina", "A friendly skeleton") catrina.set_conversation("Why hello there.") ballroom.set_character(catrina) candle = Item("Candle") candle.set_description("A candle to see your way through dark passages") kitchen.set_item(candle) current_room = kitchen backpack = [] dead = False
from character import Enemy dave = Enemy("Dave", "A smelly zombie") dave.describe() dave.set_conversation("Hola! como te llamas?") dave.talk() dave.set_weakness("Sword") print("What will you gifht with?") fight_with = input() dave.fight(fight_with)
from item import Item kitchen = Room("Kitchen") kitchen.set_description("A dank and dirty room buzzing with flies.") dining_hall = Room("Dining Hall") dining_hall.set_description("A large room with ornate decorations.") ballroom = Room("Ballroom") ballroom.set_description("A vast room with a shiny wooden floor.") # Add an enemy and it's weakness to defeat it dave = Enemy("Dave","A bad, very smelly Zombie") dave.set_weakness("cheese") # Add some conversation for Dave when talked to dave.set_conversation("Argh, me eat your brains!") # Add a friend and it's feelings kati = Friend("Kati","A friendly skeleton") kati.set_feelings("I'm very happy today!") # Add some conversation for Kati when talked to kati.set_conversation("Do you need a hug today?") # Add an item cheese = Item("Cheese") cheese.set_description("A large and smelly block of cheese") kitchen.link_room(dining_hall, "south") dining_hall.link_room(kitchen, "north") dining_hall.link_room(ballroom, "west") ballroom.link_room(dining_hall, "east")
kitchen.set_description("A dank and dirty room buzzing with flies.") ballroom.set_description( "A vast room with a shiny wooden floor; huge candlesticks guard the entrance." ) dining_hall.set_description( "A large room with ornate golden decorations on each wall.") # link the rooms kitchen.link_room(dining_hall, "south") ballroom.link_room(dining_hall, "east") dining_hall.link_room(kitchen, "north") dining_hall.link_room(ballroom, "west") # set characters dave = Enemy("Dave", "A smelly zombie!") dave.set_conversation("Ahhh...I will eat you!") dave.set_weakness("cheese") susi = Character("Susi", "A cute little puppy") susi.set_conversation("Wuff, wuff!") ricky = Friend("Ricky", "A lovely penguin") ricky.set_conversation("Hello!") # put characters into rooms dining_hall.set_character(dave) ballroom.set_character(susi) kitchen.set_character(ricky) current_room = kitchen
party_invite = Item("Party Invite") party_invite.set_description("A Party Invite on rich parchment stamped wtih the Royal Seal.") fancy = Item("Fancy Shoes") fancy.set_description("A pair of sparkling shoes that seem to be made of diamonds, and flash in the light.") ### CHARACTERS ### ###she should probably have fish in her store ha ha ha molly = Npc("Molly Malone", "A shop keeper who has the same old items, but new gossip every day.") molly.set_conversation("'Welcome to my shop!'") shop.set_character(molly) redbeard = Enemy("Redbeard", "A handsome pirate with a large red beard and suspiciously dazzling shoes.\nHe carries a large blade on his side that is knicked and marred with age.") redbeard.set_conversation("'Without the secret token, I will not allow you on board.'") redbeard.set_attack_strength(100) redbeard.set_defense_strength(100) redbeard.set_weapon("Pistol") ship.set_character(redbeard) borris = Npc("Borris Boreleon", "A stiff guard who takes joy in following orders and has been working for the Royal Family for over twenty years.") borris.set_conversation("Judging by your clothes, I doubt you have a Party Invitation. If you don't, you will need to leave or face severe consequence.") borris.set_item_give(party_invite.name) gate.set_character(borris) #### NAME COLLECTION #### def stutter_text(string):
from character import Enemy greg = Enemy("Greg", 'Just a normal dude') greg.set_conversation( "Hi, My name is greg, i'm just a normal dude trying to make his way in the text adventure" ) greg.set_weakness("fork") fight_with = input("What will you fight with: ") greg.fight(fight_with)
from character import Character from character import Enemy sylv = Enemy("Sylvanas","A dirty, smelly, morally grey banshee zombie.") sylv.describe() sylv.set_conversation("BURN IT!") sylv.talk() sylv.set_weakness("Frostmourne") print("What will you fight with?") fight_with = input() sylv.fight(fight_with)
) ballroom = Room("Ballroom") ballroom.set_description( "A vast, springy floor. A Damoclean chandelier dangles above. A revolving glitter ball twinkling stars along the walls." ) # linking the rooms kitchen.link_room(dining_hall, "south") dining_hall.link_room(ballroom, "west") dining_hall.link_room(kitchen, "north") ballroom.link_room(dining_hall, "east") # introduce a character, Dave in the Dining Hall dave = Enemy("Dave", "A smelly zombie") dave.set_conversation("That'll be your brain that I'm after") dave.set_weakness("elephant") dave.set_awake(True) dining_hall.set_character(dave) # add another enemy, Eben, in the Ballroom eben = Enemy("Eben", "An angry giant with a deep voice") eben.set_conversation("I run a large computer company") eben.set_weakness("artichoke") eben.set_awake(False) ballroom.set_character(eben) # add a friend, kate in the kitchen greta = Friend("Greta", "An environmental warrior") greta.set_conversation("Stop flying, it's madness and terrible") greta.set_awake(False)
# Define the items fromage = Item("fromage") fromage.set_readable_name("du fromage") fromage.set_description("Il sent encore plus mauvais que le zombie !") cuisine.set_item(fromage) livre = Item("livre") livre.set_readable_name("un livre") livre.set_description("Un très gros livre intitulé \"Python pour les nuls\".") salon.set_item(livre) # Define the people dave = Enemy("Dave", "Un zombie puant") dave.set_conversation("Arrrgggg... yahhhhh... manger...") dave.set_weakness("fromage") salon.set_character(dave) olga = Friend("Olga", "Un squelette sympa") olga.set_conversation("Salut ! Je suis un tas d'os.") cuisine.set_character(olga) tabatha = Enemy("Tabatha", "Une énorme araignée aux pattes velues.") tabatha.set_conversation("Pfffff.... Je m'ennuie...") tabatha.set_weakness("livre") salle_a_manger.set_character(tabatha) #Start:
gun = Item("gun") gun.set_description("A dangerous weapon keep clear") cheese = Item("cheese") cheese.set_description("A block of yellow mouldy cheese") key = Item("key") key.set_description("Your way to freedom") # Assign items to rooms kitchen.set_item(cheese) dining_room.set_item(gun) # Create characters dave = Enemy("Dave", "A smelly zombie") dave.set_conversation("I am here to eat your brains") dave.set_weakness("cheese") catrina = Friend("Catrina", "A friendly skeleton") catrina.set_conversation("I am here to guide you") # Assign characters to rooms dining_room.set_character(dave) # Function to reassign an item to a room during game def change_item(item): if item == 'gun': current_room.set_item(gun) elif item == 'cheese': current_room.set_item(cheese)