melonJS
    Preparing search index...

    Interface GridSettings

    how to build a Grid

    interface GridSettings {
        cellShape?: CellShape;
        cols: number;
        prepare?: () => void;
        rows: number;
        solid?: (col: number, row: number) => boolean;
        tileHeight: number;
        tileWidth: number;
        weight?: (col: number, row: number) => number;
        x?: number;
        y?: number;
    }
    Index
    cellShape?: CellShape

    how cells sit in the world

    "square"
    
    cols: number

    columns

    prepare?: () => void

    called before solid and weight are read for every cell (when the grid is built, and on each Grid#refresh): to gather what they read, once

    rows: number

    rows

    solid?: (col: number, row: number) => boolean

    whether a cell is solid (a wall), read for every cell when the grid is built and on Grid#refresh

    no cell is solid
    
    tileHeight: number

    a cell's height, in world units

    tileWidth: number

    a cell's width, in world units

    weight?: (col: number, row: number) => number

    what entering a cell costs, 1 or more (mud 3, a road 1), read with solid

    1
    
    x?: number

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

    0
    
    y?: number
    0