NAME
Game::TileMap::Legend - Map contents description
DESCRIPTION
All object classes must be string.
All map markers are strings with length equal to "characters_per_tile". Don't use whitespace - it is removed before parsing, so can be used freely to improve map readability, especially for multicharacter tiles.
All objects can be anything, but not undef
. String probably works best.
Attributes
characters_per_tile
The number of characters (horizontal only) than are used to define one tile.
Optional in the constructor. Default: 1
Methods
new
Moose-flavored constructor. See "Attributes" for a list of possible arguments.
Note: it may be easier to call "new_legend" in Game::TileMap.
add_wall
$legend = $legend->add_wall($marker, $wall_object);
Defines a marker used to store a wall. You are required to set this.
$wall_object
is not required, by default it will be just 'wall'
. You may have more than one wall object.
Walls are considered not a part of the map. Think of them as physical obstacles.
add_void
$legend = $legend->add_void($marker, $void_object);
Defines a marker used to store a void. You are required to set this.
$void_object
is not required, by default it will be just 'void'
. You may have more than one void object.
Voids are considered a part of the map, but they are not accessible. Think of them as chasms which you can see over, but can't walk over.
add_terrain
$legend = $legend->add_terrain($marker => $object);
Same as add_object('terrain', $marker => $object)
.
add_object
$legend = $legend->add_object('class', $marker => $object);
Adds a new object with a given class and marker.
get_class_of_object
my $class = $legend->get_class_of_object($object);
Returns the object class for a given object defined in the legend.