Skip to content

Handy Dandy Guide to Locations and Connections

sleepinghungry edited this page Jan 14, 2017 · 15 revisions

Handy Dandy Guide to Locations and Connections

Step-by-Step Reference

To create a new location

  1. Type in the game variable:
          game_variable
    Example:
          game

  2. Add the new_location command to it:
          game_variable**.new_location()**
    Example:
          game.new_location()

  3. Add the name of the location in double quotes:
          game_variable.new_location("Name of Location")
    Example:
          game.new_location("Sidewalk")

  4. Add the description of the location in double quotes (don't forget the comma):
          game.new_location("Name of Location", "Description of the location")
    Example:
          game.new_location("Sidewalk", "You are outside on a sidewalk. There is a large glass door to the east.")

  5. Store your new location in a variable:
          location_variable = game.new_location("Name of Location","Description of the location")
    Example:
          sidewalk = game.new_location("Sidewalk", "You are outside on a sidewalk. There is a large glass door to the east.")

To create a new location

  1. Type in the game variable:
          game_variable
    Example:
          game

  2. Add the new_connection command:
          game_variable**.new_connection()**
    Example:
          game.new_connection()

  3. Add the name of the connection:
          game_variable.new_connection("Name of the Connection")
    Example:
          game.new_connection("Front Door")

  4. Add the location variable where the connection starts (the "from")
          game_variable.new_connection("Name of the Connection", from_location_variable)
    Example:
          game.new_connection("Front Door", sidewalk)

  5. Add the location variable where the connection end (the "to")
          game_variable.new_connection("Name of the Connection", from_location_variable**, to_location_variable**)
    Example:
          game.new_connection("Front Door", sidewalk, vestibule)

  6. Add the direction for going from the start location to the end location (like IN or NORTH):
          game.new_connection("Name of the Connection", name_of_a_location_variable, name_of_a_location_variable**, DIRECTION**)
    Example:
          game.new_connection("Front Door", sidewalk, vestibule, IN)

  7. Add the reverse direction (the direction for going from the end location to the start location:
          game.new_connection("Name of the Connection", from_location_variable, to_location_variable, DIRECTION**, REVERSE_DIRECTION**)
    Example:
          game.new_connection("Front Door", sidewalk, vestibule, IN, OUT)

  8. Store the new connection in a variable:
          connection_variable = game.new_connection("Name of the Connection", from_location_variable, to_location_variable, DIRECTION, REVERSE_DIRECTION)
    Example:
          front_door = game.new_connection("Front Door", sidewalk, vestibule, IN, OUT)

  9. One other thing. Those square brackets [] around the directions:
    Square brackets are used for directions when you want to be able to type two different directions to go to the same place. So, you could type IN to go into a building. Or EAST to go into the same building. To make a connection have two directions go to a single location:
          connection_variable = game.new_connection("Name of the Connection", from_location_variable, to_location_variable, [DIRECTION1, DIRECTION2], [REVERSE_DIRECTION1, REVERSE_DIRECTION2])
    Example:
          front_door = game.new_connection("Front Door", sidewalk, vestibule, [IN, EAST], [OUT, WEST])

Note that where just IN used to be as the fourth piece of info needed by new_connection(), there is now [IN, EAST] as that fourth piece of information.

To set where the game starts:

  1. Type in the game variable:
          game_variable
    Example:
          game

  2. Use the new_player command:
          game**.new_player()**
    Example:
          game.new_player()

  3. Add a location variable:
          game.new_player(location_variable)
    Example:
          game.new_player(sidewalk)

  4. Store the new player in a variable:
          player_variable = game.new_player(location_variable)
    Example:
          player = game.new_player(sidewalk)

BWX Game Engine pages

Python Pages

Step By Step Guides

Building Conditionals

Lectures

Explaining Conditionals

Assignments

I Am Thinking of a Number...

Clone this wiki locally