void fillEmpty() { for (int x = 0; x < width; ++x) { for (int y = 0; y < height; ++y) { BoardObject boardObject = currentBoard.at(x, y); if (boardObject.block == null) { int id = generator.getRandomObject(); Block block = createBlockAt(x, y, id); boardObject.setBlock(block); block.updatePosition(); } } } }
public void createBoard() { currentBoard = generator.generateBoard(); for (int x = 0; x < width; ++x) { for (int y = 0; y < height; ++y) { BoardObject boardObject = currentBoard.at(x, y); int id = boardObject.id; Block block = createBlockAt(x, y, id); boardObject.setBlock(block); } } updateBlocksPosition(); }