Compare commits
3 Commits
abf907af24
...
382d850605
| Author | SHA1 | Date | |
|---|---|---|---|
| 382d850605 | |||
| a49b3b20cc | |||
| 148b5fc634 |
@@ -112,9 +112,11 @@ class Tetris extends StatelessGame {
|
||||
|
||||
private void letPlayerLoose(Player player) {
|
||||
TetrisGame tetrisGame = this.tetrisGames.get(player);
|
||||
if(!this.getScore().hasResult(player)) {
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
player.setInvisible(true);
|
||||
this.getScore().insertResult(player, tetrisGame.getScore());
|
||||
}
|
||||
|
||||
boolean allGamesLost = this.tetrisGames.values().stream()
|
||||
.filter(game -> !game.lost)
|
||||
|
||||
@@ -28,12 +28,14 @@ class TurtleGame extends StatelessGame {
|
||||
private final Map<Player, Integer> scoreMap = new WeakHashMap<>();
|
||||
private final ArrayList<Entity> snacks = new ArrayList<>();
|
||||
private final ArrayList<Entity> bombs = new ArrayList<>();
|
||||
private double speed = 2;
|
||||
private double maxSpeed = 10;
|
||||
private double speed;
|
||||
private final double maxSpeedIncrease;
|
||||
|
||||
public TurtleGame(int radius) {
|
||||
public TurtleGame(int radius, int startSpeed) {
|
||||
super(Dimension.OVERWORLD.key, "Turtle Game", new PointsWinScore());
|
||||
this.radius = radius;
|
||||
this.speed = startSpeed;
|
||||
this.maxSpeedIncrease = (double) this.radius / 4;
|
||||
|
||||
this.eventNode()
|
||||
.addListener(PlayerTickEvent.class, this::onPlayerTick);
|
||||
@@ -93,8 +95,7 @@ class TurtleGame extends StatelessGame {
|
||||
bomb.remove();
|
||||
this.generateNewBomb(2);
|
||||
this.getScore().insertResult(p, this.scoreMap.get(p));
|
||||
// TODO: Speed in Einstellungen anpassbar machen und je nach Spieleranzahl erhöhen
|
||||
this.speed += 0.5;
|
||||
this.speed += this.maxSpeedIncrease / this.getPlayers().size();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,12 +26,13 @@ public class TurtleGameFactory implements GameFactory {
|
||||
@Override
|
||||
public ConfigManager configuration() {
|
||||
return new ConfigManager()
|
||||
.addOption(new NumericOption("radius", Material.HEART_OF_THE_SEA, TranslatedComponent.byId("optionCommon#radius"), 10, 20, 30, 40));
|
||||
.addOption(new NumericOption("radius", Material.HEART_OF_THE_SEA, TranslatedComponent.byId("optionCommon#radius"), 10, 20, 30, 40))
|
||||
.addOption(new NumericOption("startSpeed", Material.LEATHER_BOOTS, TranslatedComponent.byId("game_TurtleGame#startSpeed"), 2, 4, 6));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Game manufacture(Room parent, Map<String, Option<?>> configuration) throws Exception {
|
||||
return new TurtleGame(configuration.get("radius").getAsInt()).setParent(parent);
|
||||
return new TurtleGame(configuration.get("radius").getAsInt(), configuration.get("startSpeed").getAsInt()).setParent(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user