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) {
|
private void letPlayerLoose(Player player) {
|
||||||
TetrisGame tetrisGame = this.tetrisGames.get(player);
|
TetrisGame tetrisGame = this.tetrisGames.get(player);
|
||||||
|
if(!this.getScore().hasResult(player)) {
|
||||||
player.setGameMode(GameMode.SPECTATOR);
|
player.setGameMode(GameMode.SPECTATOR);
|
||||||
player.setInvisible(true);
|
player.setInvisible(true);
|
||||||
this.getScore().insertResult(player, tetrisGame.getScore());
|
this.getScore().insertResult(player, tetrisGame.getScore());
|
||||||
|
}
|
||||||
|
|
||||||
boolean allGamesLost = this.tetrisGames.values().stream()
|
boolean allGamesLost = this.tetrisGames.values().stream()
|
||||||
.filter(game -> !game.lost)
|
.filter(game -> !game.lost)
|
||||||
|
|||||||
@@ -28,12 +28,14 @@ class TurtleGame extends StatelessGame {
|
|||||||
private final Map<Player, Integer> scoreMap = new WeakHashMap<>();
|
private final Map<Player, Integer> scoreMap = new WeakHashMap<>();
|
||||||
private final ArrayList<Entity> snacks = new ArrayList<>();
|
private final ArrayList<Entity> snacks = new ArrayList<>();
|
||||||
private final ArrayList<Entity> bombs = new ArrayList<>();
|
private final ArrayList<Entity> bombs = new ArrayList<>();
|
||||||
private double speed = 2;
|
private double speed;
|
||||||
private double maxSpeed = 10;
|
private final double maxSpeedIncrease;
|
||||||
|
|
||||||
public TurtleGame(int radius) {
|
public TurtleGame(int radius, int startSpeed) {
|
||||||
super(Dimension.OVERWORLD.key, "Turtle Game", new PointsWinScore());
|
super(Dimension.OVERWORLD.key, "Turtle Game", new PointsWinScore());
|
||||||
this.radius = radius;
|
this.radius = radius;
|
||||||
|
this.speed = startSpeed;
|
||||||
|
this.maxSpeedIncrease = (double) this.radius / 4;
|
||||||
|
|
||||||
this.eventNode()
|
this.eventNode()
|
||||||
.addListener(PlayerTickEvent.class, this::onPlayerTick);
|
.addListener(PlayerTickEvent.class, this::onPlayerTick);
|
||||||
@@ -93,8 +95,7 @@ class TurtleGame extends StatelessGame {
|
|||||||
bomb.remove();
|
bomb.remove();
|
||||||
this.generateNewBomb(2);
|
this.generateNewBomb(2);
|
||||||
this.getScore().insertResult(p, this.scoreMap.get(p));
|
this.getScore().insertResult(p, this.scoreMap.get(p));
|
||||||
// TODO: Speed in Einstellungen anpassbar machen und je nach Spieleranzahl erhöhen
|
this.speed += this.maxSpeedIncrease / this.getPlayers().size();
|
||||||
this.speed += 0.5;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,12 +26,13 @@ public class TurtleGameFactory implements GameFactory {
|
|||||||
@Override
|
@Override
|
||||||
public ConfigManager configuration() {
|
public ConfigManager configuration() {
|
||||||
return new ConfigManager()
|
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
|
@Override
|
||||||
public Game manufacture(Room parent, Map<String, Option<?>> configuration) throws Exception {
|
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
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user