User prompt
Please fix the bug: 'TypeError: butterflyGraphics.setFrame is not a function' in or related to this line: 'butterflyGraphics.setFrame(butterflyFrames[currentFrame]);' Line Number: 87
User prompt
Please fix the bug: 'TypeError: butterflyGraphics.setTexture is not a function' in or related to this line: 'butterflyGraphics.setTexture(LK.getAsset(butterflyFrames[currentFrame], {}).texture);' Line Number: 87
User prompt
create a new function playButterflyAnim similar to playPlumesAnim but for butterflies
User prompt
create a new class Butterfly that animates a butterfly using the 4 butterfly assets
Code edit (1 edits merged)
Please save this source code
User prompt
add a new function playPlumesAnim, that animates a plume asset randomly from right of the screen to the left. run it randomly like playAmbientSounds
User prompt
now include also birds3 in playAmbiantSounds
Code edit (13 edits merged)
Please save this source code
User prompt
add a new function playAmbiantSounds that randomly plays 'birds' or 'birds2'
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: storage is not defined' in or related to this line: 'self.currentLevel = storage.currentLevel || (debug && levelConfigs[0] ? 0 : 1);' Line Number: 1498 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please fix the bug: 'Unable to load plugin: @upit/storage.v1' in or related to this line: 'var storage = LK.import("@upit/storage.v1");' Line Number: 55
Code edit (1 edits merged)
Please save this source code
Code edit (8 edits merged)
Please save this source code
User prompt
Please fix the bug: 'tween is not defined' in or related to this line: 'tween(logoShadow, {' Line Number: 2264 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'Unable to load plugin: @upit/tween.v1' in or related to this line: 'var tween = LK.import("@upit/tween.v1");' Line Number: 55
Code edit (1 edits merged)
Please save this source code
User prompt
``` LK.setTimeout(function () { game.removeChild(confetti); }, 1000); ``` solve the scope bug using a closure
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Reset the storage.currentLevel just before GameOver
Code edit (10 edits merged)
Please save this source code
User prompt
Use the storage plugin to store puzzleManager.currentLevel. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
===================================================================
--- original.js
+++ change.js
@@ -161,9 +161,9 @@
self.x += self.vx;
self.y += self.vy;
self.rotation = Math.atan2(self.vy, self.vx) + Math.PI * 0.55;
// Animate size
- var sizeProgress = (200 - self.life) / 200; // Assuming life starts at 120
+ var sizeProgress = (100 - self.life) / 100; // Assuming life starts at 120
waterDropGraphics.width = self.size + sizeProgress * self.size * 2;
waterDropGraphics.height = self.size * 2 + sizeProgress * self.size * 4;
self.life--;
if (self.life <= 0) {
@@ -1443,8 +1443,9 @@
self.currentLevel++;
storage.currentLevel = self.currentLevel; // Store current level in storage
} else {
self.currentLevel = storage.currentLevel || (debug && levelConfigs[0] ? 0 : 1);
+ self.currentLevel = debug ? 0 : self.currentLevel;
}
self.isComplete = false;
};
self.initPuzzle = function () {
@@ -1839,8 +1840,9 @@
}
self.waterFlowing = true;
log("Starting water flow through solution path:", self.solutionPath.length, "tiles");
var currentIndex = 0;
+ waterFlowReachedEnd = false;
function animateNextTile() {
if (currentIndex >= self.solutionPath.length) {
// End of path reached - start end game sequence
LK.setTimeout(function () {
@@ -1867,11 +1869,19 @@
}
// Special handling for start tile
if (currentTile.type === TileFormat.TYPES.START) {
LK.getSound('waterInPipe').play();
+ var waterFlowSoundInterval = LK.setInterval(function () {
+ if (!waterFlowReachedEnd) {
+ LK.getSound('waterInPipe').play();
+ } else {
+ LK.clearInterval(waterFlowSoundInterval);
+ }
+ }, 2000);
}
// Special handling for end tile
if (currentTile.type === TileFormat.TYPES.END) {
+ waterFlowReachedEnd = true;
createWaterDrops(currentTile.x, currentTile.y + 100, game);
}
currentIndex++;
LK.setTimeout(animateNextTile, 400);
@@ -1884,9 +1894,9 @@
};
/****
* Game Variables
****/
-var debug = false;
+var debug = true;
function log() {
if (debug) {
console.log.apply(console, arguments);
}
@@ -1925,11 +1935,14 @@
var levelTextXOffset = -50;
var resetButton;
var congratsText;
var congratsTextOffset = 300;
+var nbMovesText;
+var nbMovesTextOffset = 400;
var waterDrops = [];
var flowers = [];
var waterDropInterval;
+var waterFlowReachedEnd = false;
var logo;
var logoShadow;
var puzzleManager;
var isLogoAnimInFinished = false;
@@ -2019,9 +2032,9 @@
var speed = Math.random() * 5 + 5;
var easeFactor = Math.random() * 0.05 + 0.95; // Random easing factor between 0.95 and 1.0
waterDrop.vx = Math.cos(angle) * speed * easeFactor;
waterDrop.vy = Math.sin(angle) * speed * easeFactor;
- waterDrop.life = 200;
+ waterDrop.life = 100;
waterDrop.visible = true;
}
}
function animateSoil() {
@@ -2171,8 +2184,25 @@
congratsText.blendMode = 0;
congratsText.visible = true;
// Add the level text to the game
game.addChild(congratsText);
+ // Nb Moves Text
+ nbMovesText = new Text2("Moves: 0/0", {
+ size: 300,
+ fill: 0xFFFFFF,
+ // Green Color 0x00cd20,
+ weight: 1000,
+ align: 'center',
+ dropShadow: true,
+ alpha: 0.75
+ });
+ nbMovesText.x = nbMovesTextOffset + 2048;
+ nbMovesText.y = 1750;
+ nbMovesText.anchorX = 0.5;
+ nbMovesText.blendMode = 0;
+ nbMovesText.visible = true;
+ game.addChild(nbMovesText);
+ // reset button
resetButton = new ResetButton();
resetButton.x = 2048 - 180;
resetButton.y = 130;
resetButton.visible = false;
@@ -2462,15 +2492,8 @@
});
congratsText.setText(congratsMessages[stars]);
congratsText.visible = true;
congratsText.x = congratsTextOffset + 2048;
- /*
- for (var i = 0; i < stars; i++) {
- LK.setTimeout(function () {
- LK.getSound("roundResult").play();
- }, 500 + i * 200);
- }
- */
tween(congratsText, {
x: congratsTextOffset
}, {
duration: 1000,
@@ -2488,8 +2511,31 @@
});
}, 1700);
}
});
+ // Nb Moves text
+ nbMovesText.setText("Moves: " + currentRoundMoves + "/" + levelMinimalMoves[puzzleManager.currentLevel]);
+ nbMovesText.visible = true;
+ nbMovesText.x = nbMovesTextOffset + 2048;
+ tween(nbMovesText, {
+ x: nbMovesTextOffset
+ }, {
+ duration: 1000,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ LK.setTimeout(function () {
+ tween(nbMovesText, {
+ x: nbMovesTextOffset - 2048
+ }, {
+ duration: 1000,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ nbMovesText.visible = false;
+ }
+ });
+ }, 1700);
+ }
+ });
}
function cleanPlayingState() {
log("cleanPlayingState...");
isPlaying = false;
@@ -2769,9 +2815,9 @@
/* All Corners :
0: [["F-E-0", "F-C-2", "F-C-3", ""], ["F-C-1", "F-C-0", "F-C-1", "F-C-3"], ["F-C-2", "F-C-3", "F-C-2", "F-C-0"], ["F-S-2", "F-C-1", "", "M-C-0"]],
0: [["F-S-0", "F-C-2", "F-C-3", ""], ["F-C-1", "F-C-0", "F-C-1", "F-C-3"], ["F-C-2", "F-C-3", "F-C-2", "F-C-0"], ["F-E-2", "F-C-1", "", "M-C-0"]],
*/
-var nbLevels = 10;
+var nbLevels = 12;
var levelMinimalMoves = {
0: 1,
1: 1,
2: 6,
@@ -2781,12 +2827,14 @@
6: 16,
7: 18,
8: 25,
9: 26,
- 10: 44
+ 10: 44,
+ 11: 37,
+ 12: 27
};
var levelConfigs = {
- 0: [["F-S-0", "", "", ""], ["F-V-0", "", "", ""], ["F-V-0", "", "M-H-0", ""], ["F-C-1", "F-H-0", "", "F-E-1"]],
+ 0: [["M-C-2", "F-S-0", "", ""], ["M-C-1", "M-C-0", "", "F-V-0"], ["M-C-0", "F-C-2", "M-C-3", "F-V-0"], ["M-C-1", "F-E-2", "", "M-C-3"]],
// Level 1 - 1
1: [["F-S-0", "", "", ""], ["F-V-0", "", "", ""], ["F-V-0", "", "M-H-0", ""], ["F-C-1", "F-H-0", "", "F-E-1"]],
// Level 2 - 6
2: [["", "M-V-0", "F-E-0", ""], ["", "M-C-0", "F-V-0", ""], ["", "", "", ""], ["F-S-3", "F-H-0", "", ""]],
@@ -2804,6 +2852,8 @@
8: [["", "M-V-0", "M-H-0", "F-C-3"], ["", "F-S-0", "M-C-2", "F-E-2"], ["", "F-C-0", "", ""], ["M-H-0", "", "", "M-C-1"]],
// Level 9 - 26
9: [["M-V-0", "F-C-2", "F-H-0", "F-C-3"], ["", "F-E-2", "", ""], ["", "M-V-0", "F-S-0", ""], ["", "M-C-1", "M-C-0", ""]],
// Level 10 - 38
- 10: [["M-H-0", "", "", "F-S-1"], ["M-H-0", "F-V-0", "", ""], ["M-H-0", "F-C-0", "M-C-2", "M-C-2"], ["", "", "M-C-1", "F-E-1"]]
+ 10: [["M-H-0", "", "", "F-S-1"], ["M-H-0", "F-V-0", "", ""], ["M-H-0", "F-C-0", "M-C-2", "M-C-2"], ["", "", "M-C-1", "F-E-1"]],
+ 11: [["M-C-2", "M-H-0", "M-H-0", "M-C-3"], ["M-V-0", "", "", ""], ["F-E-0", "F-C-1", "F-S-1", ""], ["F-C-1", "M-C-0", "M-H-0", ""]],
+ 12: [["M-C-2", "F-S-0", "", ""], ["M-C-1", "M-C-0", "", "F-V-0"], ["M-C-0", "F-C-2", "M-C-3", "F-V-0"], ["M-C-1", "F-E-2", "", "M-C-3"]]
};
\ No newline at end of file
straigth zenith view square light wooden pallet. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
straigth zenith view square wooden pallet with big screws in each corner Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
simple yellow rating star. Modern video game style
tileSlide
Sound effect
levelWon
Sound effect
tileBlocked
Sound effect
fountain
Sound effect
waterInPipe
Sound effect
bgMusic
Music
logoBounce
Sound effect
levelStart
Sound effect
bgMusic2
Music
flowerPop
Sound effect
roundResult
Sound effect
gameWon
Sound effect
resetSound
Sound effect
birds
Sound effect
birds2
Sound effect
birds3
Sound effect