Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: isEnabled is not defined' in or related to this line: 'if (isEnabled) {' Line Number: 985
Code edit (5 edits merged)
Please save this source code
User prompt
in handlePlayingStateUp, find a way to exit the `puzzleManager.board.forEach` loop when operation is applied to a tile because `return`doesn't seem to work
Code edit (10 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of null (reading 'type')' in or related to this line: 'var newValue = Math.max(0, currentTile.value + parseInt(operation.type));' Line Number: 1541
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(dragNode, {' Line Number: 2170 โช๐ก Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1, @upit/tween.v1
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(dragNode, {' Line Number: 2170 โช๐ก Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1, @upit/tween.v1
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(dragNode, {' Line Number: 2170 โช๐ก Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1, @upit/tween.v1
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(dragNode, {' Line Number: 2170 โช๐ก Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1, @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(dragNode, {' Line Number: 2173 โช๐ก Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1, @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(dragNode, {' Line Number: 2173 โช๐ก Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1, @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(dragNode, {' Line Number: 2174 โช๐ก Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1, @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(dragNode, {' Line Number: 2174 โช๐ก Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1, @upit/tween.v1
Code edit (15 edits merged)
Please save this source code
Code edit (25 edits merged)
Please save this source code
Code edit (25 edits merged)
Please save this source code
Code edit (9 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: Error: Invalid color format. Expected 0xRRGGBB format, received: undefined' in or related to this line: 'tween(tileGraphics, {' Line Number: 358 โช๐ก Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1, @upit/tween.v1
Code edit (6 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -637,8 +637,11 @@
}
//{4e.g}
//log("Completed animation for cell to base position:", cell.baseX, cell.baseY); // Log completion//{4e.h}
isMenuReady = true; //{4e.i}
+ if (colIndex == self.menuCells[0].length - 1 && rowIndex == self.menuCells.length - 1) {
+ backgroundImage.hideWall();
+ }
} //{4e.j}
}); //{4e.k}
}); //{4e.l}
}); //{4e.m}
@@ -883,8 +886,18 @@
};
self.show = function () {
self.visible = true;
};
+ self.pause = function (unpause) {
+ tween(self, {
+ scaleX: unpause ? 1 : 0.8,
+ scaleY: unpause ? 1 : 0.8,
+ alpha: unpause ? 1 : 0.5
+ }, {
+ duration: 300,
+ easing: tween.easeOut
+ });
+ };
return self;
});
// ResetButton class to represent the reset button
var ResetButton = Container.expand(function () {
@@ -1206,8 +1219,12 @@
self.levelData = null;
self.levelFailed = false;
// Core Functions
self.initPuzzle = function () {
+ if (currentState != GAME_STATE.NEW_ROUND) {
+ log("InitPuzzle in wrong state", currentState);
+ return;
+ }
self.loadLevel(self.currentLevel);
};
self.selectLevel = function (level) {
self.currentLevel = level;
@@ -1251,8 +1268,9 @@
if (noContinue) {
return;
}
LK.setTimeout(function () {
+ log("End Reset, currentState ", currentState);
self.loadLevel(self.currentLevel);
}, 850);
};
self.loadLevel = function (levelNumber) {
@@ -1440,8 +1458,20 @@
operation.setBasePosition(operationX, operationY, operationR); // Space buttons evenly and position near the bottom
self.game.addChild(operation);
}
};
+ self.pauseOperations = function (unpause) {
+ log("pauseOperations:", self.operations);
+ if (!self.operations || !self.operations.length) {
+ return;
+ }
+ for (var i = 0; i < self.levelData.operations.length; i++) {
+ if (self.operations[i]) {
+ var op = self.operations[i];
+ op.pause(unpause);
+ }
+ }
+ };
self.updateOperations = function () {
log("updateOperations:", self.operations);
if (!self.operations || !self.operations.length) {
return;
@@ -1471,8 +1501,9 @@
log("applyOperation... isAnimating:", self.isAnimating);
if (self.isAnimating) {
return false; // Exit if an operation is already in progress
}
+ self.pauseOperations();
self.isAnimating = true; // Set animating flag
self.propagateOperation(operation, tile);
// Remove used operation from the list
var operationIndex = self.operations.indexOf(operation);
@@ -1487,9 +1518,10 @@
self.updateOperations();
self.fillTilesNeighbors();
log("applyOperation... Ok applied done:");
self.isAnimating = false; // Reset animating flag after operation is done
- }, 3000);
+ self.pauseOperations(true);
+ }, 1000);
return true;
};
self.propagateOperation = function (operation, startTile) {
var visited = [];
@@ -1751,9 +1783,10 @@
return;
}
puzzleManager.initPuzzle();
levelNumberText.show();
- if (debug) {
+ //if (debug)
+ {
changeGameState(GAME_STATE.PLAYING);
}
}
function handleNewRoundLoop() {
@@ -1931,9 +1964,9 @@
// Implement logic for handling down event in PLAYING state
log("Handling down event in PLAYING state", obj);
puzzleManager.operations.forEach(function (operation) {
//operation.isSelected &&
- if (!dragNode && !isApplyingOperation && x >= operation.x - operation.width / 2 && x <= operation.x + operation.width / 2 && y >= operation.y - operation.height / 2 && y <= operation.y + operation.height / 2) {
+ if (!dragNode && !isApplyingOperation && !puzzleManager.isAnimating && x >= operation.x - operation.width / 2 && x <= operation.x + operation.width / 2 && y >= operation.y - operation.height / 2 && y <= operation.y + operation.height / 2) {
log("Ok Dragging operation ", operation);
dragNode = operation;
tween(operation, {
rotation: 0,
@@ -2169,12 +2202,8 @@
// Exit from loop
return;
} else {
log("Operation button is FAR FROM tile at position:", tile.x, tile.y); // Log when operation button is not above a tile
- if (!isAnimatingDragNode) {
- log("Delete drag node from Up event without tile...");
- dragNode = null;
- }
}
});
if (!tileFound) {
log("Operation button not above any tile");
@@ -2193,8 +2222,10 @@
duration: 500,
easing: tween.easeOut,
onFinish: function onFinish() {
isAnimatingDragNode = false;
+ log("Delete drag node from Up event tile not found...");
+ dragNode = null;
}
});
if (currentAdjacentTiles) {
currentAdjacentTiles.forEach(function (adjTile) {
@@ -2249,9 +2280,9 @@
//<Write imports for supported plugins here>
/***********************************************************************************************/
/****************************************** GLOBAL VARIABLES ***********************************/
/***********************************************************************************************/
-var debug = true;
+var debug = false;
var isPlaying = false;
var GAME_STATE = {
INIT: 'INIT',
MENU: 'MENU',
@@ -2435,8 +2466,9 @@
backgroundLayer.addChild(backgroundImage);
game.addChild(backgroundLayer);
game.addChild(middleLayer);
game.addChild(foregroundLayer);
+ backgroundImage.showWall();
boardContainer = new Container();
middleLayer.addChild(boardContainer);
boardContainer.x = 0;
boardContainer.y = 0;
tick
Sound effect
tileEntrance
Sound effect
tileRemove
Sound effect
operationSelect
Sound effect
operationCancel
Sound effect
tileChangeValue
Sound effect
resetSound
Sound effect
levelFailed
Sound effect
menuLevelSelect
Sound effect
menuCellEnter
Sound effect
applause
Sound effect
bgMusic
Music
tada
Sound effect