Question by
MJG1123 · Oct 23, 2015 at 08:14 PM ·
enumstatsorganizationrandom gen
Enemy and Stat Generation... is their an easy way?
So far I'm creating an enum like Creature Class (1,2,3) and using random.range to randomly choose one and... creating a function so that...
if Creature class = 2
{
health = random.range (1 -5) x playerLevel ;
attack = random.range ( 2 - 4) x playerLevel;
}
is their an easier way to attach stat values like health = (specific amount) to the creature class (2), etc?
Comment
Answer by Jessespike · Oct 23, 2015 at 08:36 PM
There are many ways. One way is to use an array:
int[] healths = new int[]{ 50, 100, 250 };
health = healths[(int)creatureClass];