Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'game.addChildAt(background, 1);' Line Number: 1989
Code edit (4 edits merged)
Please save this source code
User prompt
Fade in the new background when changing background
Code edit (1 edits merged)
Please save this source code
User prompt
Make sure the background image is centered on the screen
User prompt
Please fix the bug: 'Timeout.tick error: game.contains is not a function. (In 'game.contains(background)', 'game.contains' is undefined)' in or related to this line: 'if (game.background && game.contains(background)) {' Line Number: 1965
Code edit (1 edits merged)
Please save this source code
User prompt
Upon mission complete change the background image
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'if (!isDragoning && board && board.gems && board.gems.length > 0) {' Line Number: 1701
Code edit (1 edits merged)
Please save this source code
User prompt
When starting the game Show the sagamap for 5 second, then close the sagamap and begin the game as it does now
User prompt
Create visualization for the sagamap
User prompt
Keeping what exists.Create a new sagamap
User prompt
As the timer checks approaches zero, starting from 10, 9, 8 and so on, have a large text label overlaid on the screen counting down.
Code edit (1 edits merged)
Please save this source code
User prompt
The confetti from the mission complete, make it fly out of the middle of the screen on the y-axis.
User prompt
Please fix the bug: 'Timeout.tick error: requestAnimationFrame is not a function' in or related to this line: 'requestAnimationFrame(animateScale);' Line Number: 613
User prompt
When the Mission Complete modal appears, animate the scale of that container, the modal and the elements, to be more exciting.
Code edit (1 edits merged)
Please save this source code
User prompt
When the dragon grabs a gem, animate the scale of the gem upon grabbing.
User prompt
Implement a special row blaster gem that appears after matching more than three gems.
User prompt
Please fix the bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'x')' in or related to this line: 'var goalGemSpriteScale = currentGoalGemSprite.scale.x;' Line Number: 832
Code edit (2 edits merged)
Please save this source code
User prompt
in fillemptyspaces when checking to create a new gem - ensure Only proceed if theres no gems in any position in the gems array which is above the empty space array position
===================================================================
--- original.js
+++ change.js
@@ -1946,8 +1946,9 @@
LK.setTimeout(function () {
// After displaying the SagaMap, start the game as usual
updateBackground();
// Add the game board background to the game
+ // Add the game board background to the game
var gameBoardBg = game.addChild(LK.getAsset('gameBoardBg', {
x: 0,
y: 0,
anchorX: 0,
@@ -1958,144 +1959,127 @@
gameBoardBg.x = (game.width - gameBoardBg.width) / 2;
gameBoardBg.y = (game.height - gameBoardBg.height) / 2 + 80;
gameBoardBg.alpha = 0.6; // Set the background transparency to make it slightly visible
// Initialize the board
+ // Define assets for the game
var board = new Board();
game.addChild(board);
board.initBoard();
- animateGemsInWave(board);
-}, sagaMapDisplayTime);
-// Add the game board background to the game
-var gameBoardBg = game.addChild(LK.getAsset('gameBoardBg', {
- x: 0,
- y: 0,
- anchorX: 0,
- anchorY: 0
-}));
-gameBoardBg.width = game.width * 0.9;
-gameBoardBg.height = game.height * 0.9;
-gameBoardBg.x = (game.width - gameBoardBg.width) / 2;
-gameBoardBg.y = (game.height - gameBoardBg.height) / 2 + 80;
-gameBoardBg.alpha = 0.6; // Set the background transparency to make it slightly visible
-// Initialize the board
-// Define assets for the game
-var board = new Board();
-game.addChild(board);
-board.initBoard();
-function animateGemsInWave(board) {
- for (var i = 0; i < 8; i++) {
- for (var j = 0; j < 6; j++) {
- var gem = board.gems[i * 6 + j];
- if (gem && typeof gem.scaleUpAndDown === 'function') {
- gem.scaleUpAndDown((i + j) * 50);
+ function animateGemsInWave(board) {
+ for (var i = 0; i < 8; i++) {
+ for (var j = 0; j < 6; j++) {
+ var gem = board.gems[i * 6 + j];
+ if (gem && typeof gem.scaleUpAndDown === 'function') {
+ gem.scaleUpAndDown((i + j) * 50);
+ }
}
}
}
-}
-animateGemsInWave(board);
-// Game logic
-LK.on('tick', function () {
- // Add game logic that needs to run every frame
- // For example, checking for matches, handling animations, etc.
-});
-// Add a label with the same styling as the timer text, but with the opposite x-coordinate
-var goalTxt = new Text2('', {
- size: 100,
- weight: 500,
- fill: "#ffffff",
- x: 0,
- // Opposite x-coordinate
- y: 50,
- anchorX: 0,
- anchorY: 0,
- dropShadow: true,
- dropShadowColor: '#000000',
- shadowBlur: 4,
- shadowOffsetX: 2,
- shadowOffsetY: 2,
- strokeThickness: 7
-});
-board.addChild(goalTxt);
-goalTxt.anchor.set(0, .5);
-goalTxt.y = 100;
-goalTxt.x = 450;
-// Add hourglass sprite next to the timer
-var goalBackground = LK.getAsset('goalBackgroundSprite', {
- x: 2048 - 100,
- // Position next to the timer
- y: 50,
- // Align with the timer's top margin
- anchorX: .5,
- // Anchor right for right alignment
- anchorY: .5 // Anchor top for top alignment
-});
-goalBackground.y = goalTxt.y;
-goalBackground.x = goalTxt.x - 100; // Position next to the timer
-goalBackground.anchor.set(0.5, 0.5); // Align with the timer's top margin
-goalBackground.alpha = .6;
-var timerTxt = new Text2(game.timer.toString(), {
- size: 100,
- // Made the text smaller
- weight: 500,
- fill: "#ffffff",
- x: 2048 - 200,
- y: 50,
- anchorX: 1,
- anchorY: 0,
- dropShadow: true,
- dropShadowColor: '#000000',
- shadowBlur: 4,
- shadowOffsetX: 2,
- shadowOffsetY: 2,
- strokeThickness: 7
-});
-// Add hourglass sprite next to the timer
-var hourglassSprite = LK.getAsset('hourglass', {
- x: 2048 - 100,
- // Position next to the timer
- y: 50,
- // Align with the timer's top margin
- anchorX: .5,
- // Anchor right for right alignment
- anchorY: .5 // Anchor top for top alignment
-});
-function stopTimer() {
- if (board.timerInterval) {
- LK.clearInterval(board.timerInterval);
- }
-}
-function startTimer() {
- // Resume the game timer after the modal disappears
- stopTimer();
- board.timerInterval = LK.setInterval(function () {
- game.timer -= 1;
- timerTxt.setText(game.timer.toString());
- if (game.timer <= 0) {
- LK.showGameOver('Final Score: ' + score);
+ animateGemsInWave(board);
+ // Game logic
+ LK.on('tick', function () {
+ // Add game logic that needs to run every frame
+ // For example, checking for matches, handling animations, etc.
+ });
+ // Add a label with the same styling as the timer text, but with the opposite x-coordinate
+ var goalTxt = new Text2('', {
+ size: 100,
+ weight: 500,
+ fill: "#ffffff",
+ x: 0,
+ // Opposite x-coordinate
+ y: 50,
+ anchorX: 0,
+ anchorY: 0,
+ dropShadow: true,
+ dropShadowColor: '#000000',
+ shadowBlur: 4,
+ shadowOffsetX: 2,
+ shadowOffsetY: 2,
+ strokeThickness: 7
+ });
+ board.addChild(goalTxt);
+ goalTxt.anchor.set(0, .5);
+ goalTxt.y = 100;
+ goalTxt.x = 450;
+ // Add hourglass sprite next to the timer
+ var goalBackground = LK.getAsset('goalBackgroundSprite', {
+ x: 2048 - 100,
+ // Position next to the timer
+ y: 50,
+ // Align with the timer's top margin
+ anchorX: .5,
+ // Anchor right for right alignment
+ anchorY: .5 // Anchor top for top alignment
+ });
+ goalBackground.y = goalTxt.y;
+ goalBackground.x = goalTxt.x - 100; // Position next to the timer
+ goalBackground.anchor.set(0.5, 0.5); // Align with the timer's top margin
+ goalBackground.alpha = .6;
+ var timerTxt = new Text2(game.timer.toString(), {
+ size: 100,
+ // Made the text smaller
+ weight: 500,
+ fill: "#ffffff",
+ x: 2048 - 200,
+ y: 50,
+ anchorX: 1,
+ anchorY: 0,
+ dropShadow: true,
+ dropShadowColor: '#000000',
+ shadowBlur: 4,
+ shadowOffsetX: 2,
+ shadowOffsetY: 2,
+ strokeThickness: 7
+ });
+ // Add hourglass sprite next to the timer
+ var hourglassSprite = LK.getAsset('hourglass', {
+ x: 2048 - 100,
+ // Position next to the timer
+ y: 50,
+ // Align with the timer's top margin
+ anchorX: .5,
+ // Anchor right for right alignment
+ anchorY: .5 // Anchor top for top alignment
+ });
+ function stopTimer() {
+ if (board.timerInterval) {
+ LK.clearInterval(board.timerInterval);
}
- }, 1000);
-}
-// Logic to spin the hourglass
-var spinHourglass = function spinHourglass() {
- var rotationDuration = 500; // Duration of the spin in milliseconds
- var startTime = Date.now();
- var spinStep = function spinStep() {
- var currentTime = Date.now();
- var progress = (currentTime - startTime) / rotationDuration;
- hourglassSprite.rotation = progress * 2 * Math.PI; // Complete rotation
- if (progress < 1) {
- LK.setTimeout(spinStep, 16); // Aim for roughly 60fps
- } else {
- hourglassSprite.rotation = 0;
- startTimer();
- }
+ }
+ function startTimer() {
+ // Resume the game timer after the modal disappears
+ stopTimer();
+ board.timerInterval = LK.setInterval(function () {
+ game.timer -= 1;
+ timerTxt.setText(game.timer.toString());
+ if (game.timer <= 0) {
+ LK.showGameOver('Final Score: ' + score);
+ }
+ }, 1000);
+ }
+ // Logic to spin the hourglass
+ var spinHourglass = function spinHourglass() {
+ var rotationDuration = 500; // Duration of the spin in milliseconds
+ var startTime = Date.now();
+ var spinStep = function spinStep() {
+ var currentTime = Date.now();
+ var progress = (currentTime - startTime) / rotationDuration;
+ hourglassSprite.rotation = progress * 2 * Math.PI; // Complete rotation
+ if (progress < 1) {
+ LK.setTimeout(spinStep, 16); // Aim for roughly 60fps
+ } else {
+ hourglassSprite.rotation = 0;
+ startTimer();
+ }
+ };
+ spinStep();
};
- spinStep();
-};
-board.addChild(hourglassSprite);
-timerTxt.anchor.set(1, .5);
-timerTxt.y = 100;
-timerTxt.x = 2048 - 240;
-board.addChild(timerTxt); // Add timer display to the top GUI layer
-hourglassSprite.y = timerTxt.y;
-hourglassSprite.x = timerTxt.x + 70; // Position next to the timer
-hourglassSprite.anchor.set(0.5, 0.5); // Align with the timer's top margin
\ No newline at end of file
+ board.addChild(hourglassSprite);
+ timerTxt.anchor.set(1, .5);
+ timerTxt.y = 100;
+ timerTxt.x = 2048 - 240;
+ board.addChild(timerTxt); // Add timer display to the top GUI layer
+ hourglassSprite.y = timerTxt.y;
+ hourglassSprite.x = timerTxt.x + 70; // Position next to the timer
+ hourglassSprite.anchor.set(0.5, 0.5); // Align with the timer's top margin
+}, sagaMapDisplayTime);
\ No newline at end of file
a magical landscape of wonder and joy. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Magic, purple gem. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
glow. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Hourglass icon white. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Glow glare star. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Shiny red envelope bao, chinese new years. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Magic greem gem in odd shape. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Flying unicorn fullbody sideview. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Magic Orange Gem. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Magic Blue Drop Shaped Gem. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
remove
Brilliant Gold Checkmark. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Magic diamond. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Enchanted forest. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Celestial reAlm. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Mystic cavern. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.