import text_game
class Game(text_game.GamePlay):
""" My adventure game """
def __init__(self):
#Define each location
rooma2 = text_game.Location("Room A-2", "Your homeroom a bland grey room that slightly reminds you of a prison cell, exactly as you feel as you come here day in and day out. Your teacher has no patience to decorate so you are forced to suffer it's dullness.")
rooma1 = text_game.Location("Room A-1", "The teacher of this room is very interesting, she likes colors and animals. As you scan the walls for something to use to get into the boiler room you are slightly sickened by the sight of the room with all the pink an yellows of the decor not to mention the over fluffy style animals matched with the color scheme.")
rooma3 = text_game.Location("Room A-3","This room is currently used for the student council meetings, it's a very neat and tidy room where documents are nicely kept in a file cabinet, no one would notice if a worker had lost their keys in this room if they where to be called and accidently forgotten them.")
boilerroom = text_game.Location("Boiler Room","As the door swings open the sudden urge to vomit comes upon you suddenly, holding your sleeve to your mouth to cover a putrid oder you continue into the room. What seems to be blood covers the entierty of the walls in the room as candles sit on the ground in a ritual style. Your mind races thinking over that you might actaully die in this room. You look down next to the candles and see a human hand severed in a caring fasion, your mind goes blank and you feel a tap on your shoulder. You shakily look behind you and you see Alice she grins cutely, 'Lets go to my place' she said as a pit of darkness spills out from her mouth as she starts laughing. And now for the drederd to be continued......")
sciencelab = text_game.Location("Science Lab","The strong smell of chemicals fills the room as you enter it, slightly coughing you enter the room another step to see what is of use in this room your watery eyes notice some opened chemical cabins.")
gymnasium = text_game.Location("Gymnasium","This is a small gym sized to fit only two dozen or so people at a time it's a very tiny room for it to be called a gym if it can be called that.")
stairwell = text_game.Location("Stairwell","A normal stairwell you make your way to the bottom, there is a key sitting on the ground near the door to the boiler room, and oddly colored deep red water.")
southhall = text_game.Location("South Hall","Some oddly placed posters line the walls asking for club members and such, a door sits at the end of this hall.")
centerhall = text_game.Location("Center Hall","Trophy cases sit on either side of this part of the hall for acedemic awards to students.")
northhall = text_game.Location("North Hall","Nothing special about this part of the hall at all, you notice writing on the window at the far end that reads fluffy was here.")
#Add exits to each room
rooma2.add_exit(text_game.Location.WEST, centerhall)
centerhall.add_exit(text_game.Location.EAST, rooma2)
centerhall.add_exit(text_game.Location.SOUTH, southhall)
centerhall.add_exit(text_game.Location.NORTH, northhall)
northhall.add_exit(text_game.Location.WEST, sciencelab)
northhall.add_exit(text_game.Location.EAST, rooma1)
northhall.add_exit(text_game.Location.SOUTH, centerhall)
sciencelab.add_exit(text_game.Location.WEST, northhall)
rooma1.add_exit(text_game.Location.EAST, northhall)
southhall.add_exit(text_game.Location.WEST, gymnasium)
southhall.add_exit(text_game.Location.NORTH, centerhall)
southhall.add_exit(text_game.Location.SOUTH, stairwell)
southhall.add_exit(text_game.Location.EAST, rooma3)
rooma3.add_exit(text_game.Location.WEST, southhall)
gymnasium.add_exit(text_game.Location.EAST, southhall)
stairwell.add_exit(text_game.Location.SOUTH, boilerroom)
#add a list of possible locations to list
self.locations = []
self.locations.append(rooma2)
self.locations.append(rooma1)
self.locations.append(rooma3)
self.locations.append(gymnasium)
self.locations.append(sciencelab)
self.locations.append(boilerroom)
self.locations.append(centerhall)
self.locations.append(northhall)
self.locations.append(southhall)
self.locations.append(stairwell)
#some code deleted for clarity
#add a list of possible locations to list
self.locations = []
self.locations.append(rooma2)
self.locations.append(rooma3)
self.locations.append(rooma1)
self.locations.append(boilerroom)
self.locations.append(sciencelab)
self.locations.append(stairwell)
self.locations.append(gymnasium)
self.locations.append(southhall)
self.locations.append(northhall)
self.locations.append(centerhall)
#define objects
#define each item
letteropener = text_game.Entity("Letter Opener","An antiqued letter opener crafted to seem like it was from the 1700's it has a this tip to it.")
cellphone = text_game.Entity("Cell Phone","An old model of a cell it's pretty hefty it's got the janitors number.")
chemicals = text_game.Entity("Chemicals","A warning label reading corrosive when mixed with water and heated.")
water = text_game.Entity("Water","A normal bottle of water.")
bunsenburner = text_game.Entity("Bunsen Burner","Something used to heat chemicals.")
gloves = text_game.Entity("Gloves","Thick brown full hand gloves for sports.")
accesskey = text_game.Entity("Boiler Room Access Key","A rusted old key with a red tag on it reading boiler room.")
gymkey = text_game.Entity("Gymnasium Key","Has a red white tag on it reading gym.")
sciencekey = text_game.Entity("Science Key","A blue tag reading Sci. I'm guessing it means science.")
beaker = text_game.Entity("Beaker","A glass beaker for working with chemicals..")
# assign to rooms
rooma2.contents.add_item(letteropener)
rooma3.contents.add_item(sciencekey)
rooma1.contents.add_item(cellphone)
sciencelab.contents.add_item(beaker)
rooma3.contents.add_item(gymkey)
sciencelab.contents.add_item(bunsenburner)
sciencelab.contents.add_item(chemicals)
stairwell.contents.add_item(accesskey)
gymnasium.contents.add_item(water)
gymnasium.contents.add_item(gloves)
# Put the player in the first room to start
self.player = text_game.Player(rooma2)
def prolog():
print"""
****************************************************************************
Set the stage for your game.
Answer this question: "How did the player find themselves where they are?
*****************************************************************************
"""
def to_win():
print """
The object of the game is to ...
HINT: Any hints would be helpful.
"""
def main():
prolog()
to_win()
adv = Game()
adv.play("Enter the name of your game here.")
main()
raw_input("Press any key to exit")
This post has been edited by atraub: 01 March 2011 - 12:04 PM
Reason for edit:: Added code tags

New Topic/Question
Reply




MultiQuote




|