User prompt
in getOverlappingCells the return of empty array happens on the method inside forEach. However it's getOverlappingCells that should return an empty array
User prompt
in getOverlappingCells the if (grid[i][j]) { needs to break booth loops
User prompt
in getOverlappingCells the return of empty array happens on the method inside forEach. However it's getOverlappingCells that should return an empty array
User prompt
empty grid values are not null, just test for any nullable type in getOverlappingCells
Code edit (2 edits merged)
Please save this source code
User prompt
n getOverlappingCells, if an overlapping cell background does not have a corresponding empty grid, make getOverlappingCells return an empty array
Code edit (1 edits merged)
Please save this source code
User prompt
just use !grid[i][j] in the getOverlappingCells check
Code edit (1 edits merged)
Please save this source code
User prompt
in getOverlappingCells, if an overlapping cell background does not have a corresponding empty grid, return an empty array
User prompt
Define Game.prototype.getOverlappingCells using self rather than prototype
User prompt
In Game.prototype.getOverlappingCells just use self
User prompt
Refactor highlightOverlappingCells such that it uses a new method that returns the overlapping cells
User prompt
On stage up call the method that resets background grid
User prompt
Remove attachCellListeners we don’t need it for this game
User prompt
Move the code in highlightOverlappingCells which reset background grid to a separate method
User prompt
Use 0.15 for speed in tile rather that 0.05
User prompt
highlightOverlappingCells Don’t test with the full tile, test with the cells the tile contain
User prompt
Expose the cells that exist inside a tile. In an array, only attach the cells actually attached for type
User prompt
Expose the cells that excise inside a tile
User prompt
Fix Bug: 'TypeError: tileBounds.intersects is not a function. (In 'tileBounds.intersects(bgCellBounds)', 'tileBounds.intersects' is undefined)' in this line: 'if (tileBounds.intersects(bgCellBounds)) {' Line Number: 235
User prompt
When dragging a tile highlight the background cells that the cells inside tile overlaps while dragging
User prompt
In GridBackgroundCell add a method that can set alpha and tint on the bg cell graphics
User prompt
In the tick method in tile simply move the tile smoothly to target y,x
User prompt
Don’t tick the bottom tile that is currently being dragged
===================================================================
--- original.js
+++ change.js
@@ -130,25 +130,29 @@
var Game = Container.expand(function () {
var self = Container.call(this);
this.getOverlappingCells = function (tile) {
var overlappingCells = [];
+ var shouldReturnEmpty = false;
tile.cells.forEach(function (cell) {
var cellBounds = cell.getBounds();
for (var i = 0; i < gridWidth; i++) {
for (var j = 0; j < gridHeight; j++) {
var bgCell = bgGrid[i][j];
var bgCellBounds = bgCell.getBounds();
if (cellBounds.contains(bgCellBounds.x + bgCellBounds.width / 2, bgCellBounds.y + bgCellBounds.height / 2)) {
if (grid[i][j]) {
- overlappingCells = [];
- return overlappingCells;
+ shouldReturnEmpty = true;
+ break;
}
overlappingCells.push(bgCell);
}
}
+ if (shouldReturnEmpty) {
+ break;
+ }
}
});
- if (overlappingCells.length === 0) {
+ if (shouldReturnEmpty) {
return [];
}
return overlappingCells;
};
Simple White square round corners. Vector. No details. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Hour hand. Vector. Simple Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Simple Awesome background for clock chain reaction game. Vector high contrast.