Browse Source

Flagged number cells count as flooded

feature_Minesweeper_Playfield
kfkama 3 years ago
parent
commit
5d1aba4408
  1. 4
      src/main/java/Minesweeper/Cell.java
  2. 4
      src/main/java/Minesweeper/Playfield.java

4
src/main/java/Minesweeper/Cell.java

@ -65,6 +65,7 @@ public class Cell extends JButton {
if (type == CellType.Number) { if (type == CellType.Number) {
setBackground(Color.gray); setBackground(Color.gray);
playfield.cellDried();
} else { } else {
setBackground(Color.red); setBackground(Color.red);
} }
@ -72,6 +73,9 @@ public class Cell extends JButton {
} else { } else {
flagged = true; flagged = true;
setBackground(Color.cyan); setBackground(Color.cyan);
if (type == CellType.Number) {
playfield.cellFlooded();
}
} }
} }
} }

4
src/main/java/Minesweeper/Playfield.java

@ -134,4 +134,8 @@ public class Playfield {
System.exit(0); System.exit(0);
} }
} }
public void cellDried() {
cellsFlooded--;
}
} }
Loading…
Cancel
Save