melonJS
    Preparing search index...

    Interface PathfindingPluginOptions

    how PathfindingPlugin builds the grid of each level

    interface PathfindingPluginOptions {
        build?: (container: Container) => Grid | null;
        container?: Container;
        layer?: string;
        solid?: (tile: Tile | null, col: number, row: number) => boolean;
        subdivide?: number;
        weight?: (tile: Tile | null, col: number, row: number) => number;
        x?: number;
        y?: number;
    }

    Hierarchy (View Summary)

    Index
    build?: (container: Container) => Grid | null

    build the grid yourself instead, from whatever the level holds; return null for a level with nothing to find a way across

    container?: Container

    where the level is loaded

    the application's world
    
    layer?: string

    the name of the tile layer to build the grid from (see Grid.fromTileLayer). Without it, the grid is built from the level's collision shapes (see Grid.fromBodies).

    solid?: (tile: Tile | null, col: number, row: number) => boolean

    whether a cell is solid, from the tile in it (null for an empty cell)

    a cell with a tile is solid, an empty one is open
    
    subdivide?: number

    For the grid built from the collision shapes (no layer, no build): cut each tile into this many cells along each side, a whole number of 1 or more. Finer cells follow walls that do not keep to the tiles: a doorway narrower than a tile, between walls standing part of a tile deep, is closed on a grid of whole tiles and open on one of quarter tiles (subdivide: 4). A search crosses that many times more cells, the square of it in all.

    1
    
    weight?: (tile: Tile | null, col: number, row: number) => number

    what entering a cell costs, 1 or more

    the tile's weight custom property (set in Tiled's tileset editor), or 1

    x?: number

    where the layer's top left corner is in the world

    the layer's own position, its containers' included
    
    y?: number
    the layer's own position, its containers' included