Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'tile.x += 2 * 2048;' Line Number: 2206
User prompt
Analyse precisely the animations in initNewRoundState, then create the equivalent animations in cleanPlayingState that make elements slide out to their x minus 2048 and after the end of the anim, set x to x + 2*2048 to be ready for next initNewRoundState anim
Code edit (1 edits merged)
Please save this source code
User prompt
in initNewRoundState, add 2048 to initial tiles x then animate their entrance like for gridboard
Code edit (10 edits merged)
Please save this source code
User prompt
in initNewRoundState, add 2048 to initial gridBOard x then animate its entrance like for backgroundImage2
User prompt
in initNewRoundState, create and animation of background slide to the left using backgroundImage1 and backgroundImage2
Code edit (1 edits merged)
Please save this source code
Code edit (7 edits merged)
Please save this source code
User prompt
in cleanMenuState, animate the logo out to the left
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: tween is not defined' in or related to this line: 'tween(movingTile, {' Line Number: 1611 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (10 edits merged)
Please save this source code
User prompt
Ignore clicks before end of logo animation. use a global variable to track the enf of the anim
User prompt
Ignore clicks before end of logo animation
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (8 edits merged)
Please save this source code
User prompt
add a random rotation to flowers when spawning
===================================================================
--- original.js
+++ change.js
@@ -1251,17 +1251,10 @@
var tileStr = level[row][col];
var tile = createTile(tileStr, row, col);
if (tile) {
//gridBoard.addChild(tile);
- //tile.x += 2048; // Add 2048 to initial x position
game.addChild(tile);
self.grid[row][col] = tile;
- tween(tile, {
- x: tile.x - 2048 // Animate entrance
- }, {
- duration: 1000,
- easing: tween.easeInOut
- });
}
}
}
};
@@ -1812,13 +1805,8 @@
}, 30);
}
});
});
- //var soilAnimation = LK.setInterval(function () {
- // if (gridBoardSoil.alpha < 1) {
- // gridBoardSoil.alpha += alphaIncrement;
- // } else {
- // LK.clearInterval(soilAnimation);
growGrass.visible = true;
// Spawn a Flower in each grid cell
for (var i = 0; i < puzzleManager.gridSize; i++) {
for (var j = 0; j < puzzleManager.gridSize; j++) {
@@ -1889,9 +1877,9 @@
visible: false,
alpha: 0.75,
tint: 0x000000
});
- gridBoardSoil.x = 2048 / 2 + 20;
+ gridBoardSoil.x = 2048 / 2 + 2048 + 20;
gridBoardSoil.y = 2732 / 2 + 20;
game.addChild(gridBoardSoil);
// Initialize grid board
gridBoard = LK.getAsset('gridBoard', {
@@ -1921,9 +1909,9 @@
fill: 0x222222,
weight: 1000,
dropShadow: false
});
- levelText.x = 2048 / 2 - 50;
+ levelText.x = 2048 / 2 - 50 + 2048;
levelText.y = 250;
levelText.anchorX = 0.5;
levelText.blendMode = 3;
levelText.visible = false;
@@ -2010,8 +1998,18 @@
}
function initNewRoundState() {
log("Entering New Round State");
LK.getSound('levelStart').play();
+ // Reset puzzle manager for new round
+ if (puzzleManager) {
+ puzzleManager.initPuzzle();
+ }
+ // Show gridBoard
+ gridBoardSoil.visible = true;
+ gridBoard.visible = true;
+ levelText.visible = true;
+ levelText.setText(puzzleManager.currentLevel);
+ console.log("Levels is now ", puzzleManager.currentLevel);
// Animate background images to slide to the left
tween(backgroundImage1, {
x: -2048 / 2
}, {
@@ -2023,24 +2021,40 @@
}, {
duration: 1000,
easing: tween.easeInOut
});
- // Reset puzzle manager for new round
- if (puzzleManager) {
- puzzleManager.initPuzzle();
- }
- // Show gridBoard
- gridBoardSoil.visible = true;
- gridBoard.visible = true;
- levelText.visible = true;
- levelText.setText(puzzleManager.currentLevel);
- console.log("Levels is now ", puzzleManager.currentLevel);
tween(gridBoard, {
x: 2048 / 2
}, {
duration: 1000,
easing: tween.easeInOut
});
+ tween(gridBoardSoil, {
+ x: 2048 / 2
+ }, {
+ duration: 1000,
+ easing: tween.easeInOut
+ });
+ // Initialize grid with tiles from level configuration
+ for (var row = 0; row < puzzleManager.gridSize; row++) {
+ for (var col = 0; col < puzzleManager.gridSize; col++) {
+ var tile = puzzleManager.grid[row][col];
+ if (tile) {
+ tween(tile, {
+ x: tile.x - 2048 // Animate entrance
+ }, {
+ duration: 1000,
+ easing: tween.easeInOut
+ });
+ }
+ }
+ }
+ tween(levelText, {
+ x: 2048 / 2
+ }, {
+ duration: 1000,
+ easing: tween.easeInOut
+ });
// After a short delay, transition to PLAYING state
LK.setTimeout(function () {
changeGameState(GAME_STATE.PLAYING);
}, 1000);
@@ -2090,8 +2104,70 @@
waterDrops[i].destroy();
waterDrops.splice(i, 1);
}
}
+ // Animate elements to slide out to their x minus 2048
+ tween(backgroundImage1, {
+ x: backgroundImage1.x - 2048
+ }, {
+ duration: 1000,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ backgroundImage1.x += 2 * 2048;
+ }
+ });
+ tween(backgroundImage2, {
+ x: backgroundImage2.x - 2048
+ }, {
+ duration: 1000,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ backgroundImage2.x += 2 * 2048;
+ }
+ });
+ tween(gridBoard, {
+ x: gridBoard.x - 2048
+ }, {
+ duration: 1000,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ gridBoard.x += 2 * 2048;
+ }
+ });
+ tween(gridBoardSoil, {
+ x: gridBoardSoil.x - 2048
+ }, {
+ duration: 1000,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ gridBoardSoil.x += 2 * 2048;
+ }
+ });
+ tween(levelText, {
+ x: levelText.x - 2048
+ }, {
+ duration: 1000,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ levelText.x += 2 * 2048;
+ }
+ });
+ for (var row = 0; row < puzzleManager.gridSize; row++) {
+ for (var col = 0; col < puzzleManager.gridSize; col++) {
+ var tile = puzzleManager.grid[row][col];
+ if (tile) {
+ tween(tile, {
+ x: tile.x - 2048
+ }, {
+ duration: 1000,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ tile.x += 2 * 2048;
+ }
+ });
+ }
+ }
+ }
}
function initScoreState() {
// Show score screen
log("Entering Score State");
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