Sorry if the title was worded incorrectly, please change it if it's not quite what I describe here.
So I am creating a program to simulate some fictitious creatures, and I need many objects that all store different statistics about each individual creature with values that can all be checked at the same time. What would be the correct way to go about doing this?
For reference, here is the code that I have right now.
public class Model {
static int mfood;
static int mdefense;
static int mattack;
static int mhealth;
static int msize;
static int magg;
static boolean update = false;
public Model(int food, int meat, int defense, int attack, int health, int agg) {
mfood = food;
msize = size;
mdefense = defense;
mattack = attack;
mhealth = health;
magg = agg;
}
The problem is, of course, that I have variables that store the values that are put into the constructor that are changed each time the constructor is called. This works well if I have only one object running at a time, but I will have around a dozen, most likely. These values need to be called in other methods as well, such as
public void Attack() {
mhealth = (mhealth + mdefense) - mattack;
}
The mattack variable would be a different object from the mhealth and mdefense variables.
Thanks for any help I can get, I'm sure this is a simple fix, but I can't find the answer anywhere.