""" advent.py
goes through a bunch of rooms before finally finding the key to get out
9/1/2011 Joshua Miller """
################################################################################
#ok let's define a few key things to the adventure and ask for the username and#
#let's ask the user's name and introduce them to the game. #
################################################################################
import random
done = "Done!"
################################################################################
#Now let's ask them if they are ready, but we have to convert to upper for it #
#to work right. This variable will be used a later for a decision purpose #
################################################################################
class game():
def start():
door = "Locked"
global haveKey
haveKey = False
global fakeKeyHave
fakeKeyHave = "False"
name = input("Hello Adventurer what is your name? ")
print(" ")
intro = print("Somewhere in the distance you hear a voice saying, 'Welcome %s If you wish to exit the dungeon you must find me to get the key. In total there are 9 rooms you are in the first of these. The insructions are simple when you are given a choice are L for left U for up and so forth using the first letter of the direction.'" % name)
ready = input("Are you ready to go %s? " % name)
ready = ready.upper()
if ready == "YES":
print(" ")
print("You will now start the door is now locked you can't exit the dungeon until you have completed each room")
room.zero()
elif ready == "Y":
print(" ")
print("You will now start the door is now locked you can't exit the dungeon until you have completed each room")
room.zero()
else:
game.start()
def finished():
print("\nAmazing! You completed this game(though very simplistic), still we have to commend you for your efforts!")
print("\nWould you like to go again?")
goAgain = input("\nWould you?")
goAgain.upper()
if goAgain == "YES" or goAgain == "Y":
room.start
else:
print(done)
class room():
def zero():
print("\n Room zero...the starting point of all...you've returned here or have just started. The room has some torches lit in the corners")
print(" ")
direction = input("There are three exits to the room which way would you like to go? (L U D)")
direction = direction.upper()
if direction in "LUD":
if direction == "L" or direction == "LEFT":
room.two()
elif direction == "U" or direction == "UP":
room.four()
elif direction == "D" or direction == "DOWN":
if haveKey == True:
game.finished()
elif fakeKeyHave == "True":
print(" ")
print("You stick the key in the door and try turning it, but it won't budge. You try a little harder and it breaks...turns out that was a fake key...")
room.zero()
else:
print(" ")
print("I'm sorry %s, but you appear not to be in possession of the key nesscary to leave...please keep looking!")
room.zero()
else:
print(" ")
print("that direction is not possible")
room.zero()
def one():
print(" ")
print("This is a dead end, you look and around and see a old standing in the corner")
print(" ")
talk = input("Would you like to talk to him?")
talk.upper()
if talk == "YES":
haveKey = True
print(" ")
print("You talk to the old man and he says, 'Congratulations on finding me. I will now give you the key to exit. You have done well in coming this far. You may now leave the dungeon'")
print(" ")
print("You now have the key, you lift it over your head in triumph")
print(" ")
print("The old man says: 'Ugh...why do they always do that?'")
elif talk == "Y":
print(" ")
print("You talk to the old man and he says, 'Congratulations on finding me. I will now give you the key to exit. You have done well in coming this far. You may now leave the dungeon'")
print(" ")
print("You now have the key, you lift it over your head in triumph")
print(" ")
print("The old man says: 'Ugh...why do they always do that?'")
else:
print("The old man stares at you in silence")
room.one()
print(" ")
question = input("Would you like to exit the room?")
question.upper()
if question == "YES":
room.five()
elif question == "Y":
room.five()
else:
room.one()
def two():
print(" ")
print("You come to a room with two exits and a dim light coming in from above")
print(" ")
direction = input("Which way would you like to go?(U or R)")
direction = direction.upper()
if direction == "U":
room.three()
elif direction == "R":
room.zero()
def three():
print(" ")
print("You enter a room with another two exits. You see a few relics and a few torches in the corners.")
print(" ")
direction = input("You may go right or down to exit. What's your choice?")
direction.upper()
if direction == "R":
room.four()
elif direction == "D":
room.two()
def four():
print(" ")
print("The room is lined with expensive family jewels and a deep cackle can be heard in the distance as well there are three exits")
print(" ")
direction = input("Which direction would you like to go? (U, L, D)")
direction.upper()
if direction == "U":
room.seven()
elif direction == "L":
room.three()
elif direction == "D":
room.zero()
def five():
print(" ")
print("A room you've found looks to be a old dungeon room. The cells are are locked and there seems to be be some treasure in the one to your right")
direction = input("There are two exits one to your back and one infrontwhich way would you like to go?")
direction = direction.upper()
if direction == "U":
room.eight()
elif direction == "D":
room.one()
else:
print(" ")
print("You go that way and run into a wall")
room.five()
def six():
print(" ")
print("A furnished bedroom is before you where some of candles lit at the top of the bed. You see a mirror to your right and some moonlight fades in through the window to your left")
print("You see a key on a nightstand and pick it up(Was it really that easy?)")
fakeKeyHave = True
direction = input("Would you like to exit the room?")
def seven():
print(" ")
print("You walk into a room with three exits one seems to lead to a kitchen, and this seems to be a dining room with a long table that looks recently set and a chandiler hanging from the ceiling with candles burning")
print(" ")
direction = input("Which way would you like to go?(L, D or R)")
direction = direction.upper()
if direction == "DOWN":
room.four()
elif direction == "D":
room.four()
elif direction == "L":
room.six()
elif direction == "RIGHT":
room.eight()
elif direction == "R":
room.eight()
else:
print(" ")
print("I'm sorry that direction is impossible")
room.seven()
def eight():
print(" ")
print("You enter a kitchen with two exits, and a very expensive looking one at that!")
print(" ")
direction = input("Which way would you like to go? (LD)")
direction.upper()
if direction == "L":
room.seven
elif direction == "LEFT":
room.seven()
elif direction == "D":
room.five()
elif direction == "DOWN":
room.five()
game.start()
print(" ")
print(done)
As i said a WIP so there will be errors or weird endings to it but that will be fixed in the coming days as i run it and keep at it. Eventually I will put it on my site and support for it will be there.Feel free to tell me what you think or where it could be improved or even what could make it more worthwhile to play ;)
Edited by milleja46, 03 September 2011 - 05:17 PM.


Sign In
Create Account


Back to top









