User prompt
In the if (self.mergeMode) { test in processMergeAndGameOver set alpha to .4
User prompt
In the if (self.mergeMode) { test in processMergeAndGameOver set alpha to .3
User prompt
in tick, before calling processMergeAndGameOver set all elements of grid (not bggrid) alpha to 1
User prompt
only run the grid.forEach(function (row) { code in processMergeAndGameOver if mergeMode is true
User prompt
at the bottom of processMergeAndGameOver, inside the if (!isAnyRowMoving && !self.mergeMode) { test set the alpha on all grid (not bggrid) elements that does not belong to toMerge to .5
User prompt
at the bottom of processMergeAndGameOver, inside the if (!isAnyRowMoving && !self.mergeMode) { test set the alpha on all grid elements that does not belong to toMerge to .5
User prompt
in tick inside the allNotMoving before we set toDelete, if toDelete has any items, set mergeMode to false and call processMergeAndGameOver
User prompt
move if (!isAnyRowMoving && !self.mergeMode) { and the contents of if (!isAnyRowMoving && !self.mergeMode) { to a helper method
User prompt
update mergeConnectedNeighbors to >= 3
Code edit (1 edits merged)
Please save this source code
User prompt
in the down handler we set in addAndHandleCell, if mergeMode is true, call mergeConnectedNeighbors with the targetCell
User prompt
in stage.on('up', function (obj) { update gridContainer.addChild(cell); to addAndHandleCell
User prompt
in mergeConnectedNeighbors update self.addAndHandleCell(newCell); to use addAndHandleCell
User prompt
update cell name in addAndHandleCell to targetCell
User prompt
in stage up use mergeConnectedNeighbors rather than gridContainer.addChild(cell);
User prompt
in mergeConnectedNeighbors use addAndHandleCell rather than gridContainer.addChild(newCell);
User prompt
Add a helper method to game that accepts a cell and then does gridContainer.addChild(cell) and define a down handler on that cell.
User prompt
in mergeConnectedNeighbors only execute everything in the method if connectedNeighbors.length > 3
User prompt
move var connectedNeighbors to the top of mergeConnectedNeighbors make sure that the old one is deleted such that connectedNeighbors is only defined once
User prompt
move var connectedNeighbors to the top of mergeConnectedNeighbors make sure to delete the old one
User prompt
you do var connectedNeighbors twice in self.mergeConnectedNeighbors delete the one above connectedNeighbors
User prompt
move var connectedNeighbors to the top of mergeConnectedNeighbors
User prompt
in tile.on('down' return if mergeMode is true
User prompt
in if (connectedNeighbors.length >= 3) { instead of calling mergeConnectedNeighbors push connectedNeighbors to toMove and set mergeMode to true
User prompt
Update if (!isAnyRowMoving) { to also not execute if mergeMode is true
===================================================================
--- original.js
+++ change.js
@@ -146,11 +146,11 @@
};
});
var Game = Container.expand(function () {
var self = Container.call(this);
- self.addAndHandleCell = function (cell) {
- self.mergeConnectedNeighbors(cell);
- cell.on('down', function () {});
+ self.addAndHandleCell = function (targetCell) {
+ gridContainer.addChild(targetCell);
+ targetCell.on('down', function () {});
};
self.mergeConnectedNeighbors = function (cell) {
var connectedNeighbors = self.findConnectedNeighbors(cell);
if (connectedNeighbors.length > 3) {
Simple White square round corners. Vector. No details. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Background for relaxing puzzle game. Pastel colors, flat shaded, vector art. Flowers. Blocks. Relaxing. Clouds Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Simple White square round corners. Vector. No details. Single Game Texture. In-Game asset. 2d. White background. High contrast. No shadows.
Simple black arrow pointing up. Mouse cursor like.