User prompt
Please fix the bug: 'Uncaught Error: [object Object]addChildAt: The index undefined supplied is out of bounds 43' in or related to this line: 'boardContainer.addChildAt(tile, tile.previousZIndex); // Restore tile's original z-index' Line Number: 1117
Code edit (2 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: 234
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught Error: [object Object]addChildAt: The index undefined supplied is out of bounds 43' in or related to this line: 'boardContainer.addChildAt(tile, tile.previousZIndex); // Restore tile's original z-index' Line Number: 1114
Code edit (5 edits merged)
Please save this source code
User prompt
in ``` currentAdjacentTiles.forEach(function (adjTile) { adjTile.isHighlighted = true; tween(adjTile, { scaleX: 1.33, scaleY: 1.33 }, { duration: 200, easing: tween.easeOut }); }); ``` calculate the normalized distance to tile then use it to delay the scale anim
Code edit (1 edits merged)
Please save this source code
User prompt
create a new dedicated function for the code ``` currentAdjacentTiles.forEach(function (adjTile) { adjTile.isHighlighted = false; tween(adjTile, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.easeOut }); }); currentAdjacentTiles = []; // Clear the list after restoring scale ``` and use it
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: currentAdjacentTiles is not defined' in or related to this line: 'if (currentAdjacentTiles && currentAdjacentTiles.length > 0 && currentAdjacentTiles[0].value != tile.value) {' Line Number: 1055
Code edit (1 edits merged)
Please save this source code
User prompt
in handlePlayingStateMove, update the test `else if (tile.isHighlighted)` to also check if the tile is not in currentAdjacentTiles
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught Error: [object Object]addChildAt: The index undefined supplied is out of bounds 9' in or related to this line: 'boardContainer.addChildAt(tile, tile.previousZIndex); // Restore tile's original z-index' Line Number: 1066
User prompt
Please fix the bug: 'Uncaught Error: [object Object]addChildAt: The index undefined supplied is out of bounds 9' in or related to this line: 'boardContainer.addChildAt(tile, tile.previousZIndex); // Restore tile's original z-index' Line Number: 1064
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
in handlePlayingStateUp , if currentAdjacentTiles, restore their scale to 0 with anim
User prompt
in handlePlayingStateMove store adjacentTiles list in a new global 'currentAdjacentTiles'
User prompt
when currentHighlightedTile is set, call getAdjacentTiles then animate their scale to 1.33 too
User prompt
in handlePlayingStateMove, when a tile isHighlighted store it in a new global currentHighlightedTile
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'getAdjacentTiles')' in or related to this line: 'tween(tile, {' Line Number: 710
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'getAdjacentTiles')' in or related to this line: 'tween(tile, {' Line Number: 691
User prompt
add a new function 'getAdjacentTiles' in puzzleManager the take a tile and returns all adjacent tiles with the same value
===================================================================
--- original.js
+++ change.js
@@ -1203,24 +1203,5 @@
foregroundLayer.addChild(resetButton);
// Transition to menu state
changeGameState(GAME_STATE.MENU);
}
-initializeGame();
-self.getAdjacentTiles = function (tile) {
- var adjacentTiles = [];
- var toCheck = [tile];
- var checked = [];
- while (toCheck.length > 0) {
- var currentTile = toCheck.pop();
- if (checked.includes(currentTile)) {
- continue;
- }
- checked.push(currentTile);
- currentTile.neighbors.forEach(function (neighbor) {
- if (neighbor.value === tile.value && !checked.includes(neighbor)) {
- adjacentTiles.push(neighbor);
- toCheck.push(neighbor);
- }
- });
- }
- return adjacentTiles;
-};
\ No newline at end of file
+initializeGame();
\ No newline at end of file
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