Me and my friend are making a 2D FPS game(don't ask how, to complicated), but we have a simple system where their are 3 zombies, each with changing hit boxes depending on how close/far they are, and health. Our problem is we want to make an open world for this(we already know exactly how, once again don't ask, to complicated), and we don't ant to make a variable for each zombies health, position, and size(closeness), how can we make many zombies in random areas(random within a certain boundary) and they each still have hit boxes, health, and stuff like that? we know its possible as it is done in many other games but we don't know how to, we are using a JS framework called Processing.JS.
EDIT
Thanks to @Kevin Workman for giving me some really useful code but there is still a problem, he gave the code for each zombie having a unique X and Y but not unique health, i took his code and tried to modify it to add this but now the health is stuck at 100. Any help?
ArrayList<Zombie> zombies = new ArrayList<Zombie>();
void setup(){
size(500, 500);
for(int i = 0; i < 100; i++){
zombies.add(new Zombie());
}
}
void draw(){
background(0);
for(Zombie z : zombies){
z.draw();
}
}
class Zombie{
float x = random(500);
float y = random(500);
float r = random(5, 20);
float h = 100;
void draw(){
fill(0, 255, 0);
if(h > 0) {
ellipse(x, y, r, r);
}
if(mouseX > x - r/2 && mouseX < x + r/2 && mouseY > y - r/2 && mouseY < y + r/2 && mousePressed) {
h --;
}
println(h);
}
}