I am trying some thing that is a little beyond me. I have been mulling over it for a wile now but I have not been struck with an eureka moment yet (or even and "ah ha!" moment).
Basically my problem is that I want to be able to have troops that can gain experience and be selected to have other variables change like unit type and items. This is easy but it is complicated by the fact that I want to be able to kill of units and add new ones, purity much endlessly. I could live with an upper limit of a hundred - two hundred troops at one time. I would have something like each troop being a subsequent number but I have some vague notion that reassignment of the number for old dead troops out of order would make things more difficult. I think I want a Dynamic array, but that is just my guess. I have been reading more about this kind of array and making new objects but I am still not entirely there. I know this is some thing that must be in countless games.
The attempt I have been fumbling with is to have this array, where the sting of numbers are different stats.
Code:
public int[] Cleric = { 0, 4, -2, 1, 0, 2, 8, 0, 1, 1, 1, 1 };
public int[] Fighter = { 0, 6, -4, 2, 0, 0, 10, 1, 0, 1, 3, 1 };
public int[] Thief = { 0, 4, 4, 3, 0, 0, 6, 0, 0, 2, 2, 2 };
public int[] Wizard = { 2, 2, -2, 0, 0, 0, 4, 0, 0, 1, 1, 1 };
int[]
it is multiplied by the levels in each troop type
Code:
int[] Unitlevels = { 0, 0, 0, 0 };
so Unitlevels[2] is Thief levels.
this increases to some point and then bumps up the level and resets to zero
Code:
Unitexp = { 0, 0, 0, 0 };
all the numbers from the different troop type get added to the base troop Unit stats.
Code:
int[] Unit = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
Witch at some latter point would get added together with other modifiers for equipment and so on.
in this way I would just be keeping track of a few short variables like.
int[] Unitlevels = { 0, 0, 0, 0 };
int[] Unitexp = { 0, 0, 0, 0 };
int Curenthp;
int Equipment;
and a few other manageable variables
but it still gets me nowhere to actually solving my problem.