diff --git a/core/src/com/monjaro/gamejam/main/Game.java b/core/src/com/monjaro/gamejam/main/Game.java index f849f1b..0245dfc 100644 --- a/core/src/com/monjaro/gamejam/main/Game.java +++ b/core/src/com/monjaro/gamejam/main/Game.java @@ -28,6 +28,7 @@ public class Game extends ApplicationAdapter { private double tickProgress = 0; private Round round; + private int roundNumber = 0; private UI ui; private SegmentUI segUi; @@ -43,7 +44,8 @@ public class Game extends ApplicationAdapter { ui = new UI(this, 50, 280); - round = generateRound(0); + reroll(); + nextRound(); Face.setBlankFaceSprite(new Texture("blank_die_face.png")); Face.setPipSprite(new Texture("pip.png")); @@ -60,8 +62,6 @@ public class Game extends ApplicationAdapter { public void tick() { processInput(); - - ui.setRerolls(round.getRerolls()); } public void processInput() { @@ -86,6 +86,10 @@ public class Game extends ApplicationAdapter { dice.forEach(d -> d.setSelected(false)); //unselect all dice reroll(); //reroll + + if (round.getSegments().stream().allMatch(Segment::isDestroyed)) { //if all segments are destroyed, next round + nextRound(); + } } } } @@ -148,6 +152,10 @@ public class Game extends ApplicationAdapter { img.dispose(); } + public void nextRound() { + round = generateRound(++roundNumber); + } + public Round generateRound(int difficulty) { Random random = new Random(); int points = 5 + difficulty * 3; diff --git a/core/src/com/monjaro/gamejam/main/UI.java b/core/src/com/monjaro/gamejam/main/UI.java index 241d6ac..3db504a 100644 --- a/core/src/com/monjaro/gamejam/main/UI.java +++ b/core/src/com/monjaro/gamejam/main/UI.java @@ -10,8 +10,6 @@ public class UI extends Actor{ private final Transform position; private static Texture rerollTexture; - private int rerolls; - public UI(Game game, int x, int y) { this.game = game; position = new Transform(x, y, 0, 0); @@ -22,10 +20,6 @@ public class UI extends Actor{ position.y = y; } - public void setRerolls(int x){ - rerolls = x; - } - public static void setRerollTexture(Texture texture){rerollTexture = texture;} @Override @@ -42,4 +36,5 @@ public class UI extends Actor{ batch.setColor(Color.WHITE); } } + }