Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: levelText is not defined' in or related to this line: 'levelText.setText("?");' Line Number: 1149
Code edit (21 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: levelText is not defined' in or related to this line: 'levelText.setText("?");' Line Number: 1145
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (11 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: 235
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
in handlePlayingStateDown, if not taping an operation but tapping a tile, play tick sound
Code edit (20 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: tile is not defined' in or related to this line: 'tween(tile, {' Line Number: 945
Code edit (1 edits merged)
Please save this source code
Code edit (6 edits merged)
Please save this source code
User prompt
in createOperations, before `self.operations = [];` destroy all previous remaining operations
Code edit (10 edits merged)
Please save this source code
User prompt
adapt areNeighbors to take int oaccount the fact that the grid is hexagonal. ie: tile at 2,3 is not adjacent with tile at 1,2 even if dx=1 and dy=1
Code edit (1 edits merged)
Please save this source code
User prompt
add detailed logs in areNeighbors
User prompt
there is a problem with fillTilesNeighbors : it doesn't actually check if the the tiles are adjacent using their row and col ! please fix
User prompt
there is a problem with getAdjacentTiles algorithm : it selects tiles with same value even if there are not adjacent! please fix
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: undefined is not an object (evaluating 'self.board[0].tileSizeX')' in or related to this line: 'log("createBoard calc: ", game.width, maxCols, self.board[0].tileSizeX, -maxCols * self.board[0].tileSizeX);' Line Number: 682
===================================================================
--- original.js
+++ change.js
@@ -42,10 +42,10 @@
y: centerY + 2732
//tint: 0xFF0000
});
self.animateTransition = function (dirX, dirY) {
- if (puzzleManager.currentLevel == 1) {
- // No anim for level 1
+ if (puzzleManager.currentLevel == 1 || !dirX || !dirY) {
+ // No anim for level 1 or reset
return;
}
self.prepareSideBackgrounds(dirX, dirY);
var deltaX = -dirX * 2048;
@@ -80,10 +80,10 @@
onFinish: function onFinish() {
// Update main background like the transitioned one
var referenceNextScaleX = Math.abs(dirX) == 0 ? nextBackgroundV.scale.x : nextBackgroundH.scale.x;
var referenceNextScaleY = Math.abs(dirY) == 0 ? nextBackgroundH.scale.y : nextBackgroundV.scale.y;
- backgroundGraphics.scale.x = referenceNextScaleX; //nextBackgroundC.scale.x * (Math.abs(dirX) == 0 ? -1 : 1);
- backgroundGraphics.scale.y = referenceNextScaleY; //nextBackgroundC.scale.y * (Math.abs(dirY) == 0 ? -1 : 1);
+ backgroundGraphics.scale.x = referenceNextScaleX;
+ backgroundGraphics.scale.y = referenceNextScaleY;
// Switch backgrounds
backgroundGraphics.x = centerX;
backgroundGraphics.y = centerY;
nextBackgroundC.x += 2048;
@@ -94,18 +94,8 @@
nextBackgroundV.scale.x = 1 * backgroundGraphics.scale.x;
nextBackgroundV.scale.y = -1 * backgroundGraphics.scale.y;
nextBackgroundC.scale.x = -1 * backgroundGraphics.scale.x;
nextBackgroundC.scale.y = -1 * backgroundGraphics.scale.y;
- //backgroundGraphics.x -= deltaX;
- //backgroundGraphics.y -= deltaY;
- /*
- nextBackgroundH.x += 2048;
- nextBackgroundH.y += 2732;
- nextBackgroundV.x += 2048;
- nextBackgroundV.y += 2732;
- nextBackgroundC.x += 2048;
- nextBackgroundC.y += 2732;
- */
}
});
};
self.prepareSideBackgrounds = function (dirX, dirY) {
@@ -293,9 +283,9 @@
levelText2.visible = false;
self.addChild(levelText2);
// Method to update the level number
self.updateLevel = function (newLevel, dirX, dirY) {
- if (newLevel > 1) {
+ if (newLevel > 1 && dirX && dirY) {
if (newLevel == self.displayedLevel) {
// When reseting current level show current level in text2
levelText2.setText(self.displayedLevel.toString());
}
@@ -580,9 +570,9 @@
self.game = game;
self.activeTileCount = 0; // Initialize active tile count
self.levelBoardOffsetX = 0; // Initialize levelBoardOffsetX
self.levelBoardOffsetY = 0; // Initialize levelBoardOffsetY
- self.currentLevel = debug ? 16 : 1;
+ self.currentLevel = debug ? 21 : 1;
self.previousLevelNumber = 1;
self.board = [];
self.operations = [];
self.isAnimating = false;
@@ -638,10 +628,10 @@
self.levelData = levelConfigs[levelNumber] || {
tiles: [],
operations: []
};
- currentTransitionDirectionH = levelNumber > self.previousLevelNumber ? 1 : -1;
- currentTransitionDirectionV = Math.random() > 0.5 ? -1 : 1;
+ currentTransitionDirectionH = levelNumber > self.previousLevelNumber ? 1 : 0;
+ currentTransitionDirectionV = levelNumber > self.previousLevelNumber ? Math.random() > 0.5 ? -1 : 1 : 0;
log("transitions :", currentTransitionDirectionH, currentTransitionDirectionV);
levelNumberText.updateLevel(levelNumber, currentTransitionDirectionH, currentTransitionDirectionV);
backgroundImage.animateTransition(currentTransitionDirectionH, currentTransitionDirectionV);
self.createBoard();
@@ -1098,8 +1088,12 @@
}
function initNewRoundState() {
// Initialize the game state for NEW_ROUND
log("Initializing NEW_ROUND State");
+ if (!levelConfigs[puzzleManager.currentLevel]) {
+ changeGameState(GAME_STATE.SCORE);
+ return;
+ }
puzzleManager.initPuzzle();
levelNumberText.show();
if (debug) {
changeGameState(GAME_STATE.PLAYING);
@@ -1129,8 +1123,10 @@
}
function initScoreState() {
// Initialize the game state for SCORE
log("Initializing SCORE State");
+ //levelText.visible = false;
+ levelText.setText("?");
}
function handleScoreLoop() {
// Handle the game loop for SCORE state
log("Handling SCORE Loop");
@@ -1535,8 +1531,9 @@
var rightOperationPreselectX = centerX + 650;
var rightOperationPreselectY = 2500;
var rightOperationPreselectR = -0.15;
var levelNumberText;
+var levelText; // Define levelText in the global scope
var currentHighlightedTile;
var currentAdjacentTiles = []; // Initialize currentAdjacentTiles as a global variable
var dragNode = null;
var resetButton; // Declare resetButton as a global variable
@@ -1604,26 +1601,26 @@
"tiles": [["", 1, ""], ["", 1, 1], [2, 2, 2], ["", 1, 1], ["", 1, ""]],
"operations": ['-1', '-1']
},
3: {
- "tiles": [["", "", 1, "", ""], ["", "", 1, 1, ""], ["", 2, 2, 2, ""], ["", 2, 2, 2, 2], [3, 3, 3, 3, 3], ["", 2, 2, 2, 2], ["", 2, 2, 2, ""], ["", "", 1, 1, ""], ["", "", 1, "", ""]],
- "operations": ['+1', '+1', '-1', '-2']
- },
- 4: {
"tiles": [["", "", "", "", "", ""], ["", 2, 2, 1, 2, 2], [2, 1, 1, 1, 1, 2], ["", 2, "", "", "", 2], [3, 2, 3, 3, 2, 3], ["", 2, 3, "", 3, 2], [2, 3, 3, 3, 3, 2], ["", 2, 2, 3, 2, 2]],
"operations": ["-1", "-2", "+1", "+1"]
},
- 5: {
+ 4: {
"tiles": [["", "", 2, 2, 2, ""], ["", "", 2, 1, 1, 2], ["", 2, 1, 2, 1, 2], ["", "", 2, 1, 1, 2], ["", "", 2, 2, 2, ""], ["", "", "", "", "", ""], ["", "", 2, 2, "", ""], ["", "", 2, 1, 2, ""], [1, 1, 2, 2, "", ""]],
"operations": ["-1", "-1", "+1", "-1", "-1"]
},
- 6: {
+ 5: {
"tiles": [["", "", 3, 3, "", ""], ["", "", 3, 2, 3, ""], ["", 3, 2, 2, 3, ""], ["", 3, 2, 2, 2, 3], [3, 2, 2, 2, 2, 3], ["", "", "", 3, "", ""], ["", "", 3, 3, "", ""], ["", 1, 1, 1, 1, 1], ["", 1, 1, 1, 1, ""]],
"operations": ["+1", "-2", "-1"]
},
+ 6: {
+ "tiles": [["", "", 1, "", ""], ["", "", 1, 1, ""], ["", 2, 2, 2, ""], ["", 2, 2, 2, 2], [3, 3, 3, 3, 3], ["", 2, 2, 2, 2], ["", 2, 2, 2, ""], ["", "", 1, 1, ""], ["", "", 1, "", ""]],
+ "operations": ['+1', '+1', '-1', '-2']
+ },
7: {
"tiles": [[2, "", "", "", "", 1], ["", 2, "", "", "", 3], [2, "", 2, 3, "", 3], ["", 2, 2, "", 3, 3], ["", 2, "", "", 3, ""], ["", "", 1, "", 1, ""], ["", "", 1, 1, "", ""], ["", "", "", 1, "", ""], ["", "", "", "", "", ""]],
- "operations": ["+1", "-2", "-2"]
+ "operations": ["-2", "-1", "+1"]
},
8: {
"tiles": [["", 3, 1, 2, 1, "", ""], ["", 3, 1, 2, 1, "", ""], [3, 1, 2, 1, "", "", ""], ["", "", "", "", 1, 1, ""], [3, 3, 3, 1, 1, 1, 1], ["", 3, 3, 1, 1, 2, ""], ["", 3, 1, 1, 2, 2, ""], ["", "", 1, 1, 2, 2, ""], ["", "", 1, 2, 2, "", ""]],
"operations": ["-2", "+2", "-1", "-1", "-1"]
@@ -1660,20 +1657,24 @@
"tiles": [[1, 2, 1, 1, 1, 2, 1], ["", 1, 2, 1, 1, 2, 1], [1, 2, 4, 4, 4, 2, 1], ["", 1, 4, 4, 4, 4, 1], [3, 2, 4, 4, 4, 2, 3], ["", 1, 4, 4, 4, 4, 1], [1, 1, 2, 4, 2, 1, 1], ["", 1, 2, 1, 1, 2, 1], [1, 2, 1, 1, 1, 2, 1]],
"operations": ["-2", "-2", "-1", "+1"]
},
17: {
- "tiles": [["", 1, 1], [1, 1, 1], ["", 1, 1], ["", 1, ""]],
- "operations": ['-1']
+ "tiles": [["", 3, 3, 3, 3, 3, ""], ["", 3, 3, 3, 3, 3, 3], ["", "", 4, "", "", "", ""], ["", 3, 3, 3, 3, 3, 3], [3, 3, 3, 3, 3, 3, 3], ["", "", "", "", "", 2, ""], [3, 3, 3, 3, 3, 3, 3], ["", 3, 3, 3, 3, 3, 3], ["", 1, "", "", "", "", ""]],
+ "operations": ["-2", "-1", "-1", "+1"]
},
18: {
- "tiles": [["", 1, 1], [1, 1, 1], ["", 1, 1], ["", 1, ""]],
- "operations": ['-1']
+ "tiles": [[2, 1, 1, 1, 1, 1, 2], ["", 2, 1, 1, 1, 1, 2], ["", 2, "", 1, "", 2, ""], ["", 2, 3, "", "", 3, 2], [2, 3, 4, 1, 4, 3, 2], ["", 2, 3, 1, 1, 3, 2], [2, 3, 4, 1, 4, 3, 2], ["", 2, 3, 1, 1, 3, 2], [2, 3, 4, 1, 4, 3, 2], ["", 2, 3, "", "", 3, 2], ["", 2, 3, 1, 3, 2, ""]],
+ "operations": ["-2", "-1", "-1", "+1", "+2"]
},
19: {
- "tiles": [["", 1, 1], [1, 1, 1], ["", 1, 1], ["", 1, ""]],
- "operations": ['-1']
+ "tiles": [["", 1, "", "", "", 1, ""], ["", 1, 1, "", "", 1, 1], [1, 1, 1, "", 1, 1, 1], ["", 4, 4, 4, 4, 4, 4], [4, 2, 2, 2, 2, 2, 4], ["", 2, 4, 4, 4, 4, 2], [4, 2, 2, 2, 2, 2, 4], ["", 4, 4, 4, 4, 4, 4], [1, 1, 1, "", 1, 1, 1], ["", 1, 1, "", "", 1, 1], ["", 1, "", "", "", 1, ""]],
+ "operations": ["-3", "-1", "+2"]
},
20: {
+ "tiles": [["", "", "", 1, 2, 3, 1], ["", "", 1, 1, 2, 3, 1], [1, 1, 2, 2, 3, 1, 2], ["", 2, 2, 3, 3, 1, 2], [3, 3, 3, 1, 1, 2, 2], ["", 1, 1, 1, 2, 2, 2], [2, 2, 2, 2, 2, 2, 3], ["", 2, 2, 2, 2, 3, 3], [3, 3, 3, 3, 3, 2, 2], ["", 2, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, ""]],
+ "operations": ["-1", "-1", "-1", "-1", "+2"]
+ },
+ 21: {
"tiles": [["", 1, 1], [1, 1, 1], ["", 1, 1], ["", 1, ""]],
"operations": ['-1']
}
};
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