package com.codegym.games.minesweeper;
import com.codegym.engine.cell.*;
public class MinesweeperGame extends Game {
private GameObject[][] gameField = new GameObject[SIDE][SIDE];
// check spelling of GameObject[][] variable above
private static final int SIDE = 9;
public void initialize() {
createGame();
setScreenSize(SIDE,SIDE);
}
private void createGame(){
for (int x = 0; x < SIDE ; x++) {// on both of these, use SIDE instead of hard coding
for (int y = 0; y < SIDE ; y++) { // the loop counter, if you ever change the size of the game
// you would have to change this code as well
gameField [y] [x] = new GameObject (x, y);
setCellColor(x, y, Color.AZURE);
// setCellColor should be the same as the game object, j/i not i/j
// remember that (x,y) coords differ from accessing multi-dimensional [y][x] arrays
}
}
}
public void setScreenSize(int x, int y){
}
public void setCellColor(int x , int y , String Color){
}
}
Hi everyone..This is my code, and the error is the createGame don't call in the initialize.. Can you help me please?
Under discussion
Comments
- Popular
- New
- Old
You must be signed in to leave a comment
This page doesn't have any comments yet