I was wondering if there is something for rendering sprites that’s only close to a player or rendering sprites that are in the canvas frame.
I know I can use the dist(), but I’m using a loop to go through an array. The loop renders the sprite this way, therefore I can’t really go out of scope.
What I mean by looping through an array:
function npcBehavior() {
for (var n = npcs.length-1; n > -1; n--) {
var nn = npcs[n];
drawSprite(nn);
}
}