I'd like to loop through data from two arrays to check if any of the data's distance is close to the player.
Container arrays (only 1 element in each right now):
peopleContainers_Array.push(peopleContainer);
animalContainers_Array.push(animalContainer);
I've loaded two arrays of create js containers
into NPC_Array:
NPC_Array.push(peopleContainers_Array, animalContainers_Array);
And would like to loop through both as such to get the x,y
values of data elements in the container arrays.
for (npc_array in NPC_Array) {
//NPC_Array(peopleContainers_Array, animalContainers_Array);
for (container in NPC_Array[npc_array]) {
console.log(NPC_Array[npc_array[container].x]); //outputs undefined
}
}
Why wouldn't this work?
Thanks!