Browse Source

Reset timer on game end

feature_Minesweeper_Timer
kfkama 2 years ago
parent
commit
1a7908fa2a
  1. 4
      src/main/java/Minesweeper/MinesweeperGame.java
  2. 1
      src/main/java/Minesweeper/Playfield.java

4
src/main/java/Minesweeper/MinesweeperGame.java

@ -8,12 +8,14 @@ public class MinesweeperGame extends JPanel {
private static final long serialVersionUID = 1L;
public static final int WIDTH = 600, HEIGTH = 600;
public Playfield playfield;
public TimerLable tl;
public MinesweeperGame(int _playfieldSize, int _bombAmount) {
this.setSize(WIDTH, HEIGTH);
setLayout(null);
playfield = new Playfield(this, _playfieldSize, _bombAmount);
TimerLable tl = new TimerLable();
tl = new TimerLable();
tl.setBounds((WIDTH / 2 - 5), HEIGTH / 2 - 240, 20, 20);
add(tl);
tl.start();

1
src/main/java/Minesweeper/Playfield.java

@ -69,6 +69,7 @@ public class Playfield {
MsG.remove(cells[i][j]);
}
}
MsG.tl.reset();
generatePlayfield();
}

Loading…
Cancel
Save