User prompt
when adding an element to toDelete set isMoving to true on the element
User prompt
after the code that calls toDelete, test if all elements in toDelete are not moving. If they are all not moving, delete all elements in toDelete
User prompt
Add a new for loop at the root of the tick handler that calls .tick on each element in toDelete
User prompt
when deleting cells from toDelete only delete if none of the cells are moving
Code edit (1 edits merged)
Please save this source code
User prompt
in the root of tick, if toDelete is empty set visible on all elements in the grid to true
User prompt
when inserting the new node in the neighborhood code, set visible to false on the new node
Code edit (1 edits merged)
Please save this source code
User prompt
If a element in toDelete has isMoving being false after tick has been called, delete it and remove it from the array
User prompt
Add a new for loop at the root of the tick handler that calls .tick on each element in toDelete
User prompt
in tick calculate the colRow code before calling foreach on all forEach. Remove the other instance of var colRow
User prompt
in tick in the neighbor code remove the colRow above the line if(colRow)
User prompt
in tick remove the colRow above the line if(colRow)
User prompt
remove the colRow above the line if(colRow)
User prompt
in tick calculate the colRow code before calling foreach on all forEach
Code edit (1 edits merged)
Please save this source code
User prompt
Add the neighborCell's that are removed from grid, to the toDelete array
User prompt
add a new toDelete array to game
User prompt
when calling move on neighborCell do not use the instant attribute
User prompt
In tick, when there are 3 connected neighbors, don't delete the original cell. remove all the connected cells from the grid array and set their position to the position of the newly created cell
User prompt
In tick, when there are 3 connected neighbors, don't delete the original cell.
User prompt
if the result of findConnectedNeighbors returns 3 or more items, insert a new cell where the current cell is with type +1
User prompt
remove the code that deletes connectedNeighbors
Code edit (1 edits merged)
Please save this source code
User prompt
Inside the test that removes cells if there is more than 3, create a single new cell, in the position of where the cell that was shifted from toTest used to be. Only do this for the single original cell
===================================================================
--- original.js
+++ change.js
@@ -342,17 +342,17 @@
var connectedNeighbors = self.findConnectedNeighbors(cell);
if (connectedNeighbors.length >= 3) {
var newType = (cell.type + 1) % cell.totalTypes;
var newCell = new Cell(newType);
+ var colRow = self.findCellColRow(cell);
connectedNeighbors.forEach(function (neighborCell) {
var colRow = self.findCellColRow(neighborCell);
if (colRow) {
grid[colRow.col][colRow.row] = null;
toDelete.push(neighborCell);
neighborCell.move(cell.x, cell.y);
}
});
- var colRow = self.findCellColRow(cell);
if (colRow) {
var targetPos = self.calculateTargetPosition(colRow.col, colRow.row);
newCell.move(targetPos.x, targetPos.y, true);
grid[colRow.col][colRow.row] = newCell;
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.