Foundry Virtual Tabletop - API Documentation - Version 14
    Preparing search index...

    Class GridHex

    A helper class which represents a single hexagon as part of a HexagonalGrid. This class relies on having an active canvas scene in order to know the configuration of the hexagonal grid.

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    The cube coordinate of this hex

    The hexagonal grid to which this hex belongs.

    offset: GridOffset2D

    The offset coordinate of this hex

    Accessors

    • get center(): Point

      Return a reference to the pixel point in the center of this hexagon.

      Returns Point

    • get topLeft(): Point

      Return a reference to the pixel point of the top-left corner of this hexagon.

      Returns Point

    Methods

    • Return whether this GridHex equals the same position as some other GridHex instance.

      Parameters

      Returns boolean

      Are the positions equal?

    • Return the array of hexagons which are neighbors of this one. This result is un-bounded by the confines of the game canvas and may include hexes which are off-canvas.

      Returns GridHex[]

    • Get a neighboring hex by shifting along cube coordinates. At least two of (dq, dr, ds) must be passed, an undefined third parameter may be inferred. If all three are passed, they must sum to zero to represent a valid cube shift.

      Parameters

      • Optionaldq: number

        A number of hexes to shift along the q axis

      • Optionaldr: number

        A number of hexes to shift along the r axis

      • Optionalds: number

        A number of hexes to shift along the s axis

      Returns GridHex

      The shifted hex