mwg API
    Preparing search index...

    Function matchTerrainRule

    • Whether rule, rotated by rotationIndex of rotations steps, matches the cell at x, y.

      Parameters

      Returns boolean

      import { matchTerrainRule } from '@datamoc/mw_games/two-d/render';

      const rule = { id: 'coast', conditions: [{ dx: 1, dy: 0, hasAll: ['water'] }], images: [] };
      const flagsAt = (x: number, y: number) => (x === 1 && y === 0 ? new Set(['water']) : new Set(['land']));
      console.log(matchTerrainRule(rule, 0, 0, flagsAt)); // true