User prompt
Call place mines with 10
User prompt
Fix Bug: 'ReferenceError: Can't find variable: NumberTile' in this line: 'var number = new NumberTile(self.neighborMines);' Line Number: 20
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'this.scale.y')' in this line: 'var cellY = Math.floor(pos.y / Cell.prototype.height);' Line Number: 124
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'this.scale.x')' in this line: 'var cellX = Math.floor(pos.x / Cell.prototype.width);' Line Number: 123
User prompt
Progress the development of the game please
User prompt
You canβt change texture in LK please just hide exciting backgound and show another asset. Use a label to show the mine state
User prompt
Fix Bug: 'TypeError: cellGraphics.setTexture is not a function. (In 'cellGraphics.setTexture('number_' + self.neighborMines)', 'cellGraphics.setTexture' is undefined)' in this line: 'cellGraphics.setTexture('number_' + self.neighborMines);' Line Number: 17
User prompt
Fix Bug: 'ReferenceError: Can't find variable: cellGraphics' in this line: 'var cellX = Math.floor(pos.x / cellGraphics.width);' Line Number: 107
User prompt
Fix Bug: 'ReferenceError: Can't find variable: cellGraphics' in this line: 'cell.x = x * cellGraphics.width;' Line Number: 48
User prompt
Progress the development of the game please
User prompt
Progress the development of the game please
Initial prompt
Minesweeper
var Cell = Container.expand(function () { var self = Container.call(this); self.setPosition = function (x, y) { self.x = x * self.width; self.y = y * self.height; }; var cellGraphics = self.createAsset('cell', 'Cell Graphics', .5, .5); self.isMine = false; self.isRevealed = false; self.neighborMines = 0; self.reveal = function () { if (self.isRevealed) return; self.isRevealed = true; if (self.isMine) { cellGraphics.setTexture('mine'); } else { cellGraphics.setTexture('number_' + self.neighborMines); } }; self.placeMine = function () { self.isMine = true; }; self.calculateNeighborMines = function (getNeighbor) { self.neighborMines = 0; var neighbors = getNeighbor(self.x, self.y); for (var i = 0; i < neighbors.length; i++) { if (neighbors[i].isMine) { self.neighborMines++; } } }; }); var Board = Container.expand(function () { var self = Container.call(this); self.revealAllMines = function () { for (var x = 0; x < self.cells.length; x++) { for (var y = 0; y < self.cells[x].length; y++) { var cell = self.cells[x][y]; if (cell.isMine) { cell.reveal(); } } } }; var boardGraphics = self.createAsset('board', 'Board Graphics', .5, .5); self.cells = []; self.generateBoard = function (width, height) { for (var x = 0; x < width; x++) { self.cells[x] = []; for (var y = 0; y < height; y++) { var cell = new Cell(); self.addChild(cell); self.cells[x][y] = cell; cell.setPosition(x, y); } } }; self.revealCell = function (x, y) { if (x < 0 || x >= self.cells.length || y < 0 || y >= self.cells[x].length) return; var cell = self.cells[x][y]; if (!cell.isRevealed) { cell.reveal(); return cell.isMine; } }; self.placeMines = function (mineCount) { var placedMines = 0; while (placedMines < mineCount) { var x = Math.floor(Math.random() * self.cells.length); var y = Math.floor(Math.random() * self.cells[x].length); if (!self.cells[x][y].isMine) { self.cells[x][y].placeMine(); placedMines++; } } }; self.calculateAllNeighborMines = function () { var getNeighbor = function (x, y) { var neighbors = []; for (var dx = -1; dx <= 1; dx++) { for (var dy = -1; dy <= 1; dy++) { if (dx === 0 && dy === 0) continue; var nx = x + dx, ny = y + dy; if (nx >= 0 && nx < self.cells.length && ny >= 0 && ny < self.cells[nx].length) { neighbors.push(self.cells[nx][ny]); } } } return neighbors; }; for (var x = 0; x < self.cells.length; x++) { for (var y = 0; y < self.cells[x].length; y++) { self.cells[x][y].calculateNeighborMines(getNeighbor); } } }; }); var Game = Container.expand(function () { var self = Container.call(this); var board = self.addChild(new Board()); var gameOver = false; board.generateBoard(10, 10); board.placeMines(); board.calculateAllNeighborMines(); self.on('down', function (obj) { var pos = obj.event.getLocalPosition(self); var cell = new Cell(); var cellX = Math.floor(pos.x / cell.width); var cellY = Math.floor(pos.y / cell.height); board.revealCell(cellX, cellY); if (board.cells[cellX][cellY].isMine) { gameOver = true; board.revealAllMines(); LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } }); });
===================================================================
--- original.js
+++ change.js
@@ -103,10 +103,11 @@
board.placeMines();
board.calculateAllNeighborMines();
self.on('down', function (obj) {
var pos = obj.event.getLocalPosition(self);
- var cellX = Math.floor(pos.x / cellGraphics.width);
- var cellY = Math.floor(pos.y / cellGraphics.height);
+ var cell = new Cell();
+ var cellX = Math.floor(pos.x / cell.width);
+ var cellY = Math.floor(pos.y / cell.height);
board.revealCell(cellX, cellY);
if (board.cells[cellX][cellY].isMine) {
gameOver = true;
board.revealAllMines();
Sea mine. Minesweeper. Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Watery background. 10x10 Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Single white square. Round corners. Vector. Simple details. Flat shaded. No shadows. No outlines.