The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Game::TileMap::Tile - Map tile representation

DESCRIPTION

This is a simple struct-like object that holds data about one tile on a map.

Attributes

x

Horizontal position of this tile on a map.

y

Vertical position of this tile on a map.

contents

Contents of the tile. By default, same as "type", but you can change it with "set_contents".

is_wall

Is this tile a wall?

is_void

Is this tile a void?

type

Type of the tile, as defined in the legend (as $object)

Methods

new

Moose-flavored constructor. See "Attributes" for a list of possible arguments.

In addition, the constructor requires the argument legend - map legend, but it is only required during building of the object (not stored).

set_contents

Sets new "contents" for this tile. Useful if you want to specify this tile without changing the legend (which may be used across many maps). You can set contents to be anything, since "type" is what is used to perform any checks.