package com.codegym.games.minesweeper;
import com.codegym.engine.cell.*;
public class MinesweeperGame extends Game {
private static final int SIDE = 9;
public void setScreenSize(int a,int b){
int width = a;
int length = b;
}
private GameObject[][] gameField = new GameObject[SIDE][SIDE];
public void initialize() {
createGame();
int columnCount = SIDE;
int lineCount = SIDE;
setScreenSize(columnCount,lineCount);
}
private void createGame() {
for(int i = 0; i < 9; i++ ){
for(int j = 0; j < 9; j++){
gameField[i][j] = new GameObject(j,i);
setCellColor(i,j,Color.ORANGE);
}
}
}
}
The createGame() method must be called in the initialize() method.
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Anonymous #10410173 Full Stack Developer
19 August 2019, 09:41
you Should Simply do like
+1
Nithin
24 July 2019, 05:56
#1: Remove the setScreensize method in line 10. It is already implemented in the game class which we need to use.
#2: I think line 31 has to be setCellColor(j,i,Color.ORANGE);
0