Exemple #1
0
class Scene(object):
    
    def __init__(self):
        self.person = Person()

    def enter(self):
        print "This scene is not yet configured. Subclass it amd implement enter()."
        exit(1)
        
    def get_action(self):
        action = raw_input("> ")
        if (action == "exit"):
            exit(0)
            self.get_action()
        elif (action == "read map" and self.person.has_item("map")):
            print " _~_     ___ "
            print "|_L_|---|_r_|"
            print " ___     _|_ "
            print "|_S_|---|_r_|"
            print "         _|_ "
            print "        |_x_|"
            return self.get_action()
        elif (action == "read paper" and self.person.has_item("paper")):
            print "*******"
            print "Hurry to the passage, the machines have"
            print "found us! If you encounter one then use the"
            print "trap we put in place by shouting the password" 
            print "*******" 
            return self.get_action()
        elif (action == "inventory"):
            print self.person.items
            return self.get_action()
        else:
            return action