I wonder if my aproach into modelling difficulty level for my game is good.
public abstract class AbstractDifficulty {
public AbstractDifficulty() {
}
public abstract int enemyWaves();
public abstract int enemiesInWave();
public abstract long enemyWaveIntervalMilis();
}
And then several subclasses which implement those methods, for example.
public class EasyDifficulty extends AbstractDifficulty {
@Override
public int enemyWaves() {
return 1;
}
@Override
public int enemiesInWave() {
return 10;
}
@Override
public long enemyWaveIntervalMilis() {
return 500;
}
}
I wonder if there is a simpler way to do this, but the same easy and clean to use as this.
Edit: Could someone be so kind to explain to me why this question got minus votes. Is something wrong with this code, or my explanation ? Thanks.
enemiesInWaveBase = 10 * difficultyMod, and then setting difficultyMod to 0.7 for easy, 1.0 for normal and 1.5 for hard or something. Less code, less flexible.