User prompt
instead of `currentRoundMoves - levelMinimalMoves[puzzleManager.currentLevel];` create a new function: calculateStarsScore() that returns `3-currentRoundMoves - levelMinimalMoves[puzzleManager.currentLevel];`
Code edit (2 edits merged)
Please save this source code
User prompt
in animateRoundExit, spawn a RatingStar with parameter of (currentRoundMoves - levelMinimalMoves[puzzleManager.currentLevel]) at x = 2048+2048/2 then animate it to 2048/2
Code edit (1 edits merged)
Please save this source code
User prompt
after levelConfigs; at the end of the code; add a new global levelMinimalMoves that is an object with properties from 0 to 10; all properties will have the value 1
User prompt
add a new global, currentRoundMoves that count the number of moves player do duing the round. if will be set to 0 in initNewRoundState
User prompt
create a new class RatingStars. its constructor can take a integer parameter stars from 1 to 3. It will have a starsContainer. It will have 3 slots for star asset
Code edit (14 edits merged)
Please save this source code
User prompt
Please fix the bug: 'tween is not defined' in or related to this line: 'simpleTween(logo, {' Line Number: 2009 āŖš” 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: 45
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -1787,9 +1787,9 @@
}
function animateSoil() {
log("Animate soil...");
//gridBoardSoil.visible = true;
- gridBoardSoil.alpha = 0;
+ //gridBoardSoil.alpha = 0;
var alphaIncrement = 0.05; // Adjust the increment for desired speed
// Animate all baseTile tiles' alpha from 1 to 0
puzzleManager.grid.forEach(function (row) {
row.forEach(function (tile) {
@@ -1803,52 +1803,52 @@
}, 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++) {
- var x = i * tileSize + gridBoard.x - gridBoard.width / 2 + tileSize / 2 + boardOffsetX;
- var y = j * tileSize + gridBoard.y - gridBoard.height / 2 + tileSize / 2 + boardOffsetY;
- var flower = new Flower(puzzleManager.currentLevel, x, y);
- flowers.push(flower);
- game.addChild(flower);
- }
- }
- // Animate all pipeContainer tiles' alpha from 1 to 0
- puzzleManager.grid.forEach(function (row) {
- row.forEach(function (tile) {
- log("animate pipeContainer tile:", tile);
- if (tile && tile.pipeContainer) {
- tile.pipeContainer.alpha = 1;
- LK.setInterval(function () {
- if (tile.pipeContainer.alpha > 0) {
- tile.pipeContainer.alpha -= alphaIncrement * 0.5;
- }
- }, 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++) {
+ var x = i * tileSize + gridBoard.x - gridBoard.width / 2 + tileSize / 2 + boardOffsetX;
+ var y = j * tileSize + gridBoard.y - gridBoard.height / 2 + tileSize / 2 + boardOffsetY;
+ var flower = new Flower(puzzleManager.currentLevel, x, y);
+ flowers.push(flower);
+ game.addChild(flower);
+ }
+ }
+ // Animate all pipeContainer tiles' alpha from 1 to 0
+ puzzleManager.grid.forEach(function (row) {
+ row.forEach(function (tile) {
+ log("animate pipeContainer tile:", tile);
+ if (tile && tile.pipeContainer) {
+ tile.pipeContainer.alpha = 1;
+ LK.setInterval(function () {
+ if (tile.pipeContainer.alpha > 0) {
+ tile.pipeContainer.alpha -= alphaIncrement * 0.5;
}
- });
- });
- // Animate growGrass alpha from 0 to 1
- var grassAnimation = LK.setInterval(function () {
- if (growGrass.alpha < 1) {
- growGrass.alpha += alphaIncrement; // Adjust the increment for desired speed
- } else {
- LK.clearInterval(grassAnimation);
- LK.setTimeout(function () {
- cleanPlayingState();
- initNewRoundState();
- }, 2000);
- }
- }, 80); // Adjust the interval for desired speed
+ }, 30);
+ }
+ });
+ });
+ // Animate growGrass alpha from 0 to 1
+ var grassAnimation = LK.setInterval(function () {
+ if (growGrass.alpha < 1) {
+ growGrass.alpha += alphaIncrement; // Adjust the increment for desired speed
+ } else {
+ LK.clearInterval(grassAnimation);
+ LK.setTimeout(function () {
+ cleanPlayingState();
+ initNewRoundState();
+ }, 2000);
}
- }, 30); // Adjust the interval for desired speed
+ }, 80); // Adjust the interval for desired speed
+ // }
+ //}, 30); // Adjust the interval for desired speed
}
/****
* Game State Management
****/
@@ -1856,8 +1856,19 @@
// Init and Add backgroundLayer
backgroundLayer = new Container();
middleLayer = new Container();
game.addChild(backgroundLayer);
+ // Initialize grid board shadow
+ gridBoardSoil = LK.getAsset('gridBoardSoil', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ visible: false,
+ alpha: 0.75,
+ tint: 0x000000
+ });
+ gridBoardSoil.x = 2048 / 2 + 20;
+ gridBoardSoil.y = 2732 / 2 + 20;
+ game.addChild(gridBoardSoil);
// Initialize grid board
gridBoard = LK.getAsset('gridBoard', {
anchorX: 0.5,
anchorY: 0.5,
@@ -1865,18 +1876,8 @@
});
gridBoard.x = 2048 / 2;
gridBoard.y = 2732 / 2;
game.addChild(gridBoard);
- // Initialize grid board soil
- gridBoardSoil = LK.getAsset('gridBoardSoil', {
- anchorX: 0.5,
- anchorY: 0.5,
- visible: false,
- alpha: 0
- });
- gridBoardSoil.x = 2048 / 2;
- gridBoardSoil.y = 2732 / 2;
- game.addChild(gridBoardSoil);
game.addChild(middleLayer);
// Create growGrass asset
growGrass = LK.getAsset('growGrass', {
anchorX: 0.5,
@@ -1889,15 +1890,18 @@
middleLayer.addChild(growGrass);
// Initialize game assets and variables
puzzleManager = new PuzzleManager(game);
// Initialize level text
- levelText = new Text2("Level 1", {
- size: 100,
- fill: 0xFFFFFF
+ levelText = new Text2("1", {
+ size: 200,
+ fill: 0x111111,
+ weight: 1000,
+ dropShadow: false
});
- levelText.x = 2048 / 2;
- levelText.y = 200;
+ levelText.x = 2048 / 2 - 100;
+ levelText.y = 250;
levelText.anchorX = 0.5;
+ levelText.blendMode = 3;
levelText.visible = false;
// Add the level text to the game
game.addChild(levelText);
// Transition to menu state
@@ -1980,16 +1984,17 @@
});
backgroundPlaying1.x = 2048 / 2;
backgroundPlaying1.y = 2732 / 2;
backgroundLayer.addChild(backgroundPlaying1);
- //levelText.visible = true;
- //levelText.text = "Level 1";
+ levelText.visible = true;
+ levelText.text = puzzleManager.currentLevel;
// Reset puzzle manager for new round
log("Entering New Round State");
if (puzzleManager) {
puzzleManager.initPuzzle();
}
// Show gridBoard
+ gridBoardSoil.visible = true;
gridBoard.visible = true;
// After a short delay, transition to PLAYING state
LK.setTimeout(function () {
changeGameState(GAME_STATE.PLAYING);
@@ -2023,13 +2028,8 @@
}
}
function cleanPlayingState() {
isPlaying = false;
- // Reset gridBoardSoil visibility and alpha
- if (gridBoardSoil) {
- gridBoardSoil.visible = false;
- gridBoardSoil.alpha = 0;
- }
// Hide growGrass
if (growGrass) {
growGrass.visible = false;
growGrass.alpha = 0;
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