feat: add distance limitation to isPlayerVisible

This commit is contained in:
Renge 2022-04-24 20:49:57 -04:00
parent 94da5fef26
commit 58ef5cb59f

View File

@ -143,6 +143,10 @@ export default class EnemyAI extends StateMachineAI implements BattlerAI {
let start = this.owner.position.clone();
let delta = pos.clone().sub(start);
if (delta.mag() >= 640) {
return null;
}
// Iterate through the tilemap region until we find a collision
let minX = Math.min(start.x, pos.x);
let maxX = Math.max(start.x, pos.x);