@2d-game-grid/square
Version:
A simple square grid made for games
13 lines (12 loc) • 406 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.mapCells = mapCells;
/**
* Converts the path coordinates into an array of cells
* @param grid The grid
* @param path An array of path coordinates ([x, y])
* @returns An array of cells in the same order as the path
*/
function mapCells(grid, path) {
return path.map(([col, row]) => grid.getCell({ row, col }));
}