What do you mean when you say difficulty? How many of the following are you looking to define?
- HP of creeps
- Armour/Resistances of creeps
- Speed of creeps
- Abilities of creeps
- Size (if this is a factor) of creeps
- Number of creeps (the more there are the less hp they have but also the less effective single target towers are and vise versa)
- Time before the next wave starts
Keep in mind difficulty can be controlled by limiting the player's resources when building towers, reducing the sell value of towers, restricting tower placement, hiding information from the player, adding game play elements such as towers being damaged, etc.
A more refined question: Are you looking to randomize the "strength" of creeps and have each wave be the same creep x50 or have randomized "strengths" and randomized creeps (thus waves can consist of different types of creeps with different attributes)?
EDIT: Without the following information hopefully I can guide you in the right direction with this.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| private Random dice = new Random(); private int difficulty = 8;
public int getRandomNumberFrom_To_(int min, int max) { return dice.nextInt((max - min + 1)) + min; }
public void setCreepHP() { creepObject.setHP(getRandomNumberFrom_To_(1 + (difficulty / 2), difficulty) * 10); } |