@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
30 lines (21 loc) • 635 B
JavaScript
import { CellMatcher } from "../../../rules/CellMatcher.js";
import AABB2 from "../../../../core/geom/2d/aabb/AABB2.js";
export class CellMatcherWithinAABB extends CellMatcher {
area = new AABB2();
/**
*
* @param {number} x0
* @param {number} y0
* @param {number} x1
* @param {number} y1
* @returns {CellMatcherWithinAABB}
*/
static from(x0, y0, x1, y1) {
const r = new CellMatcherWithinAABB();
r.area.set(x0, y0, x1, y1);
return r;
}
match(grid, x, y, rotation) {
return this.area.containsPoint(x, y);
}
}