Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- class Scene(object):
- def play_scene(self, title):
- text = open(str(title + ".txt"), 'r')
- print text.read()
- text.close()
- # test = SceneHandler()
- # test.play_scene('room1')
- class Death(object):
- deaths = {'giant': "The giant picks you up by your feet and bites off your head.",
- 'starve': "You continue on. Darkness falls on the forest around you. You are not seen again.",
- 'disappear': "You wander into the passage alone and wander in the darkness for the rest of your days.",
- 'pit': "Wrong key! The trapdoor swings open beneath you. You enter a freefall and land on the wooden spikes.",
- 'beheading': "Wrong. In a single blow, the skeleton slices off your head. Later."
- }
- def scenes(self, type):
- print Death.deaths[type]
- class RoomOne(Scene):
- def __init__(self):
- self.play_scene('beginning')
- def enter(self):
- input = raw_input(">>> ")
- death_answers = ['keep going', 'turn around', 'pass', 'ignore']
- live_answers = ['go into the house', 'walk toward the smoke']
- if input in live_answers:
- return Cottage().enter()
- elif input in death_answers:
- Death().scenes('starve')
- class Cottage(Scene):
- def __init__(self):
- self.play_scene('cottage')
- def enter(self):
- input = raw_input(">>> ")
- death_answers = ['fight the giant', 'run away', 'do nothing']
- live_answers = ['hide']
- if input in live_answers:
- Dungeon().enter()
- if input in death_answers:
- Death().scenes('giant')
- class Dungeon(Scene):
- def __init__(self):
- self.play_scene('dungeon')
- def enter(self):
- key = randint(1,3)
- print key
- input = int(raw_input(">>> "))
- death_answers = ['none', 'leave']
- if input in death_answers:
- return Death().scenes('disappear')
- if input == key:
- Tunnels().enter()
- else:
- Death().scenes('pit')
- class Tunnels(Scene):
- def __init__(self):
- self.play_scene('tunnels')
- def enter(self):
- input1 = raw_input("Riddle 1 Answer: ")
- if input1 == "Dancing in the Dark":
- print "Correct!"
- input2 = raw_input("Riddle 2 Answer: ")
- if input2 == "1972":
- print "Correct!"
- input3 = raw_input("Riddle 3 Answer: ")
- if input3 == "20":
- print "Correct!"
- TreasureRoom()
- else:
- Death().scenes('beheading')
- else:
- Death().scenes('beheading')
- else:
- Death().scenes('beheading')
- class TreasureRoom(Scene):
- def __init__(self):
- self.play_scene('treasure_room')
- RoomOne().enter()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement