Moved speeds to LevelManager

This commit is contained in:
Urban Modig
2025-08-31 19:53:38 +02:00
parent 2e9e7cc45e
commit 3a4a0a1824
6 changed files with 53 additions and 31 deletions

View File

@ -3,6 +3,34 @@ package se.urmo.game.state;
import lombok.Getter;
public class LevelManager {
@Getter
private int level = 1;
public enum Level {
LEVEL1(1,6000, 0.75, 0.85, FruitType.CHERRY);
private final int frightendedDuration;
private final double ghostSpeed;
private final double pacmanSpeed;
private final FruitType fruitType;
private final int level;
Level(int level, int frightendedDuration, double ghostSpeed, double pacmanSpeed, FruitType fruitType) {
this.level = level;
this.frightendedDuration = frightendedDuration;
this.ghostSpeed = ghostSpeed;
this.pacmanSpeed = pacmanSpeed;
this.fruitType = fruitType;
}
public static Level forLevel(int i) {
return Level.values()[i];
}
}
@Getter
private Level currentLevel = Level.LEVEL1;
public double getPacmanLevelSpeed() {
return currentLevel.pacmanSpeed;
}
public double getGhostSpeed() {
return currentLevel.ghostSpeed;
}
}