Directionclass
A Direction object represents a direction in which an actor might attempt to travel. The library defines eight compass directions (north, south, etc.) and a further eight special directions (in, out, up, down, port, starboard, fore and aft), but game code can define additional directions if required.
The convention that should be followed in naming a Direction object is to use the name of the direction followed by Dir; e.g. the Direction object corresponding to north is called northDir. Custom directions should follow the same convention, since it is assumed by the goInstead() and goNested() macros.
class
Direction
: object
Superclass Tree (in declaration order)
Direction
` object`
Subclass Tree
Direction
CompassDirection
ShipboardDirection
Global Objects
Summary of Properties
allDirections
departureName
dirProp
name
nameTab
opposite
sortingOrder
Summary of Methods
classInit
initializeDirection
oppositeProp
propDir
Properties
allDirections
A Class property containing a Vector of all the directions defined in the game (the 16 defined in the library plus any additionasl custom directions defined in game code)
departureName
The name to use when departing via this direction, e.g. ‘to the north’
dirProp
The exit property of a room association with this Direction, e.g. &north (corresponding to northDir).
name
The name of this direction, e.g. ‘north’. This is the name that appears in the exit lister.
nameTab
Class property: a LookupTable matching names to direction objects.
opposite
The direction that is opposite to this one.
sortingOrder
Our sorting order in the master list. We use this to present directions in a consistent, aesthetically pleasing order in listings involving multiple directions. The sorting order is simply an integer that gives the relative position in the list; the list of directions is sorted from lowest sorting order to highest. Sorting order numbers don’t have to be contiguous, since we simply put the directions in an order that makes the sortingOrder values ascend through the list.
Methods
classInit ( )
Class initialization - this is called once on the class object. We’ll build our master list of all of the Direction objects in the game, and then sort the list using the sorting order.
initializeDirection ( )
Initialize. We’ll use this routine to add each Direction instance to the master direction list (Direction.allDirections) during pre-initialization.
oppositeProp (prop)
The dirProp that’s the opposite to prop
propDir (prop)
The direction to which prop points.
Adv3Lite Library Reference Manual
Generated on 15/03/2023 from adv3Lite version 1.6.1