def go (direction): """ makes the player move in a given direction. """ global location here = places.getById(location) # complain if we can't go that way. if direction not in here.exits: print "You cannot go that way!" print return # Foxy only comes out if the player visits the closet. if location == 'CLOSET': things.getById('foxy').location = 'WEST HALLWAY' # if foxy is sprinting at you but there isn't any sauce, you cannot move fast enough to leave. if location == things.getById('foxy').location and 'mangled' not in things.getById('foxy').tags: print "You cannot move fast enough." print return # move us over that-a-ways! print "You go " + direction + "." print location = here.exits[direction]
def go(direction): """ makes the player move in a given direction. """ global location here = places.getById(location) # complain if we can't go that way. if direction not in here.exits: print "You cannot go that way!" print return # Foxy only comes out if the player visits the closet. if location == 'CLOSET': things.getById('foxy').location = 'WEST HALLWAY' # if foxy is sprinting at you but there isn't any sauce, you cannot move fast enough to leave. if location == things.getById( 'foxy').location and 'mangled' not in things.getById('foxy').tags: print "You cannot move fast enough." print return # move us over that-a-ways! print "You go " + direction + "." print location = here.exits[direction]
def look (): """ makes the player look at the current room """ global location here = places.getById(location) # Where are we? Show this place's title and description: print " - " + here.title + " -" print here.description print # display any Things in the area, unless they're hidden. thingsHere = [thing for thing in things.getByLocation(location) if "hidden" not in thing.tags] # <-- list comprehension! one of many ways python is awesome if len(thingsHere) > 0: for thing in thingsHere: print " " + thing.short_description print
def look(): """ makes the player look at the current room """ global location here = places.getById(location) # Where are we? Show this place's title and description: print " - " + here.title + " -" print here.description print # display any Things in the area, unless they're hidden. thingsHere = [ thing for thing in things.getByLocation(location) if "hidden" not in thing.tags ] # <-- list comprehension! one of many ways python is awesome if len(thingsHere) > 0: for thing in thingsHere: print " " + thing.short_description print