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
User prompt
play bgMusic in loop
Code edit (1 edits merged)
Please save this source code
User prompt
create a new confetti class. use line asset. call it in playFinalAnimation
Code edit (1 edits merged)
Please save this source code
User prompt
add random tint to confettis
Code edit (4 edits merged)
Please save this source code
Code edit (18 edits merged)
Please save this source code
User prompt
in start fadeOut, add a delay in the foreach loop of 100*index for each letter
User prompt
in start fadeOut, add a LK.setTimeout in the foreach loop of 100*index for each letter
Code edit (4 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -147,9 +147,9 @@
anchorX: 0.5,
anchorY: 0.5
});
// Set initial properties
- self.speed = Math.random() * 5 + 4; // Random speed between 2 and 7
+ self.speed = Math.random() * 7 + 5;
self.rotationSpeed = Math.random() * 0.1 - 0.05; // Random rotation speed
lineGraphics.tint = Math.random() * 0xFFFFFF; // Random tint color
self.update = function () {
// Update position and rotation
@@ -951,9 +951,9 @@
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0,
- tint: 0xEAEEE8
+ tint: 0xf4f6f3
});
self.down = function () {
self.disable();
menuButton.deactivate();
@@ -987,9 +987,9 @@
};
self.enable = function () {
log("Reset button enable...");
self.isEnabled = true;
- buttonGraphics.alpha = 1.0; // Restore full opacity to indicate it's enabled
+ buttonGraphics.alpha = 1; // Restore full opacity to indicate it's enabled
self.interactive = true; // Enable interaction
tween(self, {
scaleX: 1.0,
scaleY: 1.0
@@ -1011,10 +1011,9 @@
}, {
duration: 500,
easing: tween.easeOut
});
- if (self.isEnabled) {
- // TODO : Remplacer par puzzel.made move!!!!!!!!
+ if (!puzzleManager.isPristine) {
self.enable();
}
};
self.deactivate = function () {
@@ -1120,10 +1119,10 @@
self.letterGraphics.push(letterContainer);
self.addChild(letterContainer);
});
self.fadeOut = function () {
- LK.getSound('tileRemove').play();
self.letterGraphics.forEach(function (letterContainer) {
+ LK.getSound('tileRemove').play();
tween(letterContainer, {
scaleX: 0,
scaleY: 0,
rotation: Math.PI / 2
@@ -1263,8 +1262,9 @@
self.maxReachedLevelNumber = debug ? self.currentLevel : storage.maxReachedLevelNumber || 1; // Retrieve from storage or default to 1
self.board = [];
self.operations = [];
self.isAnimating = false;
+ self.isPristine = true;
self.selectedOperation = null;
self.moveCount = 0;
self.levelData = null;
self.levelFailed = false;
@@ -1346,13 +1346,13 @@
self.levelFailed = false;
// Load the current level
self.previousLevelNumber = self.currentLevel;
if (noContinue) {
- console.log("End Reset, but no continue. currentState", currentState);
+ log("End Reset, but no continue. currentState", currentState);
return;
}
LK.setTimeout(function () {
- console.log("End Reset, now loadLevel currentState ", currentState);
+ log("End Reset, now loadLevel currentState ", currentState);
self.loadLevel(self.currentLevel);
}, 850);
};
self.loadLevel = function (levelNumber) {
@@ -1369,8 +1369,9 @@
backgroundImage.animateTransition(currentTransitionDirectionH, currentTransitionDirectionV);
self.createBoard();
self.fillTilesNeighbors();
self.createOperations();
+ self.isPristine = true;
//LK.setTimeout(self.animateTilesEntrance, levelNumber == 1 ? 0 : 800);
//LK.setTimeout(self.animateOperationsEntrance, 900);
//LK.setTimeout(self.updateOperations, 900);
LK.setTimeout(function () {
@@ -1585,8 +1586,9 @@
log("applyOperation... isAnimating:", self.isAnimating);
if (self.isAnimating) {
return false; // Exit if an operation is already in progress
}
+ self.isPristine = false;
self.pauseOperations();
self.isAnimating = true; // Set animating flag
self.propagateOperation(operation, tile);
// Remove used operation from the list
@@ -1597,15 +1599,16 @@
operation.destroy();
}
}
self.checkWinCondition();
+ var unpauseDelay = Math.min(1500, 300 + 300 * (self.board.length / 15));
LK.setTimeout(function () {
self.updateOperations();
self.fillTilesNeighbors();
- log("applyOperation... Ok applied done:");
+ log("applyOperation... Ok applied done on tiles:", self.board.length);
self.isAnimating = false; // Reset animating flag after operation is done
self.pauseOperations(true);
- }, 1000);
+ }, unpauseDelay);
return true;
};
self.propagateOperation = function (operation, startTile) {
var visited = [];
@@ -1715,13 +1718,13 @@
};
self.checkWinCondition = function () {
log("checkWinCondition... Active tiles:", self.activeTileCount);
if (self.activeTileCount <= 0) {
- self.playVictoryAnimation();
isPlaying = false;
resetButton.disable();
menuButton.deactivate();
LK.setTimeout(function () {
+ self.playVictoryAnimation();
self.previousLevelNumber = self.currentLevel;
self.currentLevel++; // Advance to the next level
gameHints.removeHint();
if (self.currentLevel > self.maxReachedLevelNumber) {
@@ -1742,9 +1745,9 @@
// Animation Functions
self.playVictoryAnimation = function () {
log("playVictoryAnimation...previousLevelNumber", self.previousLevelNumber);
// Play level complete animation
- playFinalAnimation(); // TEMP DEBUG
+ LK.getSound("tada").play();
};
self.playLevelFailedAnimation = function () {
log("playLevelFailedAnimation...");
LK.getSound("levelFailed").play();
@@ -1906,8 +1909,9 @@
showHintsInterval = LK.setTimeout(function () {
gameHints.showHint1();
}, 2000);
}
+ resetButton.disable();
// LK.setTimeout(function () {
// //resetButton.disable();
// resetButton.activate(); // Make resetButton visible in PLAYING state
// menuButton.activate();
@@ -2624,9 +2628,9 @@
puzzleManager = new PuzzleManager(game);
if (debug && resetProgress) {
puzzleManager.maxReachedLevelNumber = 1;
}
- isPreviouslyWon = puzzleManager.maxReachedLevelNumber >= 30;
+ isPreviouslyWon = puzzleManager.maxReachedLevelNumber > 30;
startButton = new StartButton();
startButton.x = centerX; // Center horizontally
startButton.y = centerY; // Center vertically
startButton.visible = true;
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