# Add a robot. Robots can take commands to perform actions. robby = Robot("Robby") robby.set_location(sidewalk) # Add a Pet. Pets are like Animals because they can act autonomously, # but they also are like Robots in that they can take commands to # perform actions. fido = Pet("Fido") fido.set_location(sidewalk) # Make the player. hero = Player() # Add the actors to the game. Players, animals, robots, and pets are # all kinds of actors. game.add_actor(hero) game.add_actor(cat) game.add_actor(robby) game.add_actor(fido) # add a custom actor verb (in this case for the hero) def throw(self, actor, noun, words): if noun and actor.get_verb('drop').act(actor, noun, words): print 'The %s bounces and falls to the floor' % noun return True else: print 'You hurt your arm.' return False hero.add_verb(Verb(throw, 'throw'))
"You are teleported in the middle of what is probably a mile-wide and two-miles long room full of little 'igloos'. Your iCommunicator beams:" "'Welcome volunteer! Volunteering in a simple, gentle act of love. " "We provide 'Happypills50K' for free, please use liberally. Feel free to go in your very own, personal blood room(TM)!'" , "on") personal_blood_room = Location( "Blood Room igloo", "Your personal blood room is rather spartan; only the bare necessities for 12 hours of happy labour. Your iCommunicator beams:" "'Lay in bed and volunteer your blood. Have some pills if you want." , "on") hero = SV() game.add_actor(hero) game.add_location(lobby) game.add_location(blood_room) #-------------------------------------------------------------------- game.add_location(personal_blood_room) happypills = Food("happypills50K", "happypills50K: A pill a day takes the boredom away", Say("Happy pills make me happy!")) personal_blood_room.add_object(happypills) happypills = Food("happypills50K", "happypills50K: A pill a day takes the boredom away", Say("Happy pills make me happy!")) blood_extractor = BloodExtractor("BE50K", "An infernally-looking machine that extracts blood", Say("This looks rather funny...?"), hero)