Browse Source

Refactore Playfield

feature_Minesweeper_Playfield
kfkama 3 years ago
parent
commit
30903220e9
  1. 3
      src/main/java/Minesweeper/MinesweeperGame.java
  2. 6
      src/main/java/Minesweeper/Playfield.java

3
src/main/java/Minesweeper/MinesweeperGame.java

@ -24,7 +24,8 @@ public class MinesweeperGame extends JPanel {
f.setSize(WIDTH, HEIGTH); f.setSize(WIDTH, HEIGTH);
f.setLayout(null); f.setLayout(null);
f.setVisible(true); f.setVisible(true);
} }
} }

6
src/main/java/Minesweeper/Playfield.java

@ -12,6 +12,10 @@ public class Playfield {
public Playfield(MinesweeperGame _MsG, int _Size, int _bombAmount) { public Playfield(MinesweeperGame _MsG, int _Size, int _bombAmount) {
MsG = _MsG; MsG = _MsG;
Size = _Size; Size = _Size;
generatePlayfield(_bombAmount);
}
public void generatePlayfield(int _bombAmount) {
cells = new Cell[Size][Size]; cells = new Cell[Size][Size];
@ -53,7 +57,7 @@ public class Playfield {
} }
} }
} }
public void calculateBombProximity(int row, int column) { public void calculateBombProximity(int row, int column) {
if (row > 0) { if (row > 0) {

Loading…
Cancel
Save