changes hitbox getters to get properties, adds aaContains

This commit is contained in:
2023-11-03 05:12:19 -06:00
parent 601bc51233
commit 62b13e49e7
4 changed files with 135 additions and 28 deletions

View File

@@ -19,8 +19,6 @@ export class Polygon {
doodler.line(p1.copy().add(this.center), p2.copy().add(this.center), {
color,
});
const { x, y, w, h } = this.aaHitbox();
doodler.drawRect(new Vector(x, y), w, h, { color: "lime" });
}
}
@@ -35,7 +33,7 @@ export class Polygon {
return center;
}
circularHitbox(): CircleLike {
get circularHitbox(): CircleLike {
let greatestDistance = 0;
for (const p of this.points) {
greatestDistance = Math.max(
@@ -50,7 +48,7 @@ export class Polygon {
};
}
aaHitbox(): axisAlignedBoundingBox {
get aaHitbox(): axisAlignedBoundingBox {
let smallestX, biggestX, smallestY, biggestY;
smallestX =
smallestY =