1 decade ago by Bushstar
I have implemented proximity code for some entities and am not totally happy with it. Currently the entity is checking if the player entity is within a certain distance from it 200 or -200 on the x and y axis. What this means is that the entity is scanning a 400x400 square around itself. I would like to make this a circle with a radius of 200 instead. My code as it stands.
if ((player.pos.x - this.pos.x > 200 && player.pos.x - this.pos.x < 200) && (player.pos.y - this.pos.y > 200 && player.pos.y - this.pos.y < 200)) { this.playerRegistered(); }