NAME

Game::TextMapper::Point::Hex - a hex on a map

SYNOPSIS

use Modern::Perl;
use Game::TextMapper::Point::Hex;
my $hex = Game::TextMapper::Point::Hex->new(x => 1, y => 1, z => 0);
say $hex->svg_region('', [0]);
# <polygon id="hex110"  points="50.0,86.6 100.0,173.2 200.0,173.2 250.0,86.6 200.0,0.0 100.0,0.0" />

DESCRIPTION

This class holds information about a hex region: coordinates, a label, and types. Types are the kinds of symbols that can be found in the region: a keep, a tree, a mountain. They correspond to SVG definitions. The class knows how to draw a SVG polygon at the correct coordinates using these definitions.

For attributes and methods, see Game::TextMapper::Point.

Additional Methods

corners

Return the relative SVG coordinates of the points making up the shape, i.e. six for Game::TextMapper::Point::Hex and four for Game::TextMapper::Point::Square.

The SVG coordinates are arrays with x and y coordinates relative to the center of the shape.

SEE ALSO

This is a specialisation of Game::TextMapper::Point.

The SVG size is determined by $dx and $dy from Game::TextMapper::Constants.