silphius/app/ecs-systems/calculate-aabbs.js

24 lines
447 B
JavaScript
Raw Normal View History

2024-06-10 22:42:30 -05:00
import {System} from '@/ecs/index.js';
export default class CalculateAabbs extends System {
2024-06-26 07:41:07 -05:00
static get priority() {
return {
after: 'ApplyForces',
};
}
2024-06-10 22:42:30 -05:00
tick() {
2024-06-22 12:30:25 -05:00
for (const {Position: {x, y}, VisibleAabb} of this.ecs.changed(['Position'])) {
if (VisibleAabb) {
VisibleAabb.x0 = x - 32;
VisibleAabb.x1 = x + 32;
VisibleAabb.y0 = y - 32;
VisibleAabb.y1 = y + 32;
2024-06-10 22:42:30 -05:00
}
}
}
}