Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'tint')' in or related to this line: 'self.boxGraphics.tint = 0x222222;' Line Number: 152
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'tint')' in or related to this line: 'self.boxGraphics.tint = 0xffffff;' Line Number: 146
Code edit (1 edits merged)
Please save this source code
Code edit (21 edits merged)
Please save this source code
User prompt
Please fix the bug: 'instructions is not defined' in or related to this line: 'game.addChild(instructions);' Line Number: 761
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: particleGraphics.setScale is not a function' in or related to this line: 'particleGraphics.setScale(sc, sc);' Line Number: 314
Code edit (1 edits merged)
Please save this source code
Code edit (13 edits merged)
Please save this source code
User prompt
please make the particles move upwards in a wavy pattern instead of straight like now. Use individual amplitude for particles so they don't all move exactly the same.
User prompt
Please fix the bug: 'ReferenceError: particleGraphicsGraphics is not defined' in or related to this line: 'self.addChild(particleGraphicsGraphics);' Line Number: 313
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in or related to this line: 'if (self.particles.length < self.particlesMax) {' Line Number: 329
Code edit (1 edits merged)
Please save this source code
Code edit (18 edits merged)
Please save this source code
User prompt
Please fix the bug: 'tileTypes is not defined' in or related to this line: 'var boxGraphics = self.attachAsset(tileTypes[colorIndex], {' Line Number: 124
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'star is not defined' in or related to this line: 'stars.push(star);' Line Number: 260
Code edit (22 edits merged)
Please save this source code
User prompt
Please make the levelcomplete screen contain and display a fireworks explosion when it opens
Code edit (1 edits merged)
Please save this source code
User prompt
please place an instance of the gamelogo center screen top
Code edit (3 edits merged)
Please save this source code
User prompt
please loop the testmusic instead of the background music
User prompt
make a background music asset to be looped continously
===================================================================
--- original.js
+++ change.js
@@ -222,8 +222,25 @@
}
});
};
});
+var LevelComplete = Container.expand(function () {
+ var self = Container.call(this);
+ var arrowGraphics = self.attachAsset('levelCompleteBg', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ alpha: 0.75
+ });
+ var label = new Text2('Level Cleared!', {
+ size: 100,
+ fill: 0xdddddd,
+ align: 'center'
+ });
+ label.anchor.set(0.5, 0.5);
+ label.x = 0;
+ label.y = -100;
+ self.addChild(label);
+});
var Star = Container.expand(function (startX, startY, endX, endY, delay, boxTint) {
var self = Container.call(this);
//GoldCoin.delayIncrement = 0;
//self.game = this;
@@ -433,10 +450,10 @@
// Add game logo to the center top of the screen
var gameLogo = LK.getAsset('gameLogo', {
anchorX: 0.5,
anchorY: 0.5,
- x: 250,
- y: 250
+ x: 1024,
+ y: 300
});
game.addChild(gameLogo);
// Create and position the score label
var scoreLabel = new Text2('Score\n0', {
@@ -445,9 +462,9 @@
align: 'center'
});
scoreLabel.anchor.set(1, 0); // Anchor to the right
scoreLabel.x = 2048 - 50; // Position near the right edge
-scoreLabel.y = 50; // Position at the top
+scoreLabel.y = 140; //50; // Position at the top
//LK.gui.topRight.addChild(scoreLabel);
game.addChild(scoreLabel);
// Create and position the high score label
var highScoreLabel = new Text2('Best\n0', {
@@ -456,24 +473,27 @@
align: 'center'
});
highScoreLabel.anchor.set(1, 0); // Anchor to the right
highScoreLabel.x = 2048 - 75; // Position near the right edge
-highScoreLabel.y = 220; // Position below the score label
+highScoreLabel.y = 300; //220; // Position below the score label
//LK.gui.topRight.addChild(highScoreLabel);
game.addChild(highScoreLabel);
var levelLabel = new Text2('Level 1', {
- size: 120,
+ size: 60,
+ //120,
fill: 0xFFFFFF,
align: 'center'
});
-levelLabel.anchor.set(0.5, 0.5);
-levelLabel.x = 1024; // Position near the right edge
-levelLabel.y = 100; // Position at the top
+//levelLabel.anchor.set(0.5, 0.5);
+levelLabel.anchor.set(1, 0);
+levelLabel.x = 2048 - 30; // Position near the right edge
+levelLabel.y = 50; //300;
//LK.gui.topRight.addChild(scoreLabel);
game.addChild(levelLabel);
var gridSize = 5;
var spacingRatio = 0.2; //0.2;
var boardSize = 1300;
+var boardCenterY = 2732 / 2 + 250;
function calculateTileSize() {
// Example of getting desired tileSize depending on gridSize (for different size grids)
// maintaining 1300px board size and 0.2 gutter between tiles.
var tileSize = boardSize / ((gridSize + 1) * spacingRatio + gridSize);
@@ -482,9 +502,9 @@
}
var tileSize = calculateTileSize();
var board = new Board();
board.x = 1024;
-board.y = 2732 / 2;
+board.y = boardCenterY; //2732 / 2 + 200;
game.addChild(board);
// 0 black 1 white 2 yellow 3 red 4 blue 5 green 6 purple 7 grey 8 brown 9 skin
var colors = ['0x000000', '0xffffff', '0xffff00', '0xff0000', '0x0000dd', '0x00ff00', '0xff00ff', '0xbbbbbb', '0x827364', '0xecbcb4'];
// 5x5 levels.
@@ -554,9 +574,9 @@
});
var stars = [];
var levelContainer = new Container();
levelContainer.x = 1024;
-levelContainer.y = 2732 / 2;
+levelContainer.y = boardCenterY; //2732 / 2 + 200;
game.addChild(levelContainer);
function randomLevelSelection() {
var levelsPerGridSize = 2; // how many levels do we want with each size grid in the final levels array?
var t = [levels5, levels6, levels7, levels8, levels9, levels10];
@@ -917,8 +937,11 @@
}
highScoreLabel.setText('Best\n' + highScore);
}
//moveIn();
+var showingLevelCompleteCounter = 0;
+var showingLevelCompleteCounterMax = 120;
+var levelCompleteScreen = new LevelComplete();
var GAME_STATE = -1;
// -1: INIT
// 0: Waiting for input
// 1: Removing tiles
@@ -949,8 +972,9 @@
if (placeOutliers()) {
GAME_STATE = 3;
} else {
GAME_STATE = 4;
+ showingLevelCompleteCounter = 0;
}
}
} else if (GAME_STATE == 3) {
// generating new outliers
@@ -961,31 +985,49 @@
} else if (GAME_STATE == 4) {
// go to next level or game completed.
// If we haven't run out of levels, fo to the next one.
if (currentLevelID != levels.length - 1) {
- currentLevelID++;
- //currentLevel = levels[currentLevelID].slice(0);
- currentLevel = levels[currentLevelID].map(function (arr) {
- return arr.slice();
- });
- console.log('new level is', currentLevel);
- gridSize = currentLevel.length;
- tileSize = calculateTileSize();
- board.destroy();
- board = new Board();
- board.x = 1024;
- board.y = 2732 / 2;
- game.addChild(board);
- levelContainer.destroy();
- levelContainer = new Container();
- levelContainer.x = 1024;
- levelContainer.y = 2732 / 2;
- game.addChild(levelContainer);
- //levelContainer = new Container();
- paintLevel(currentLevel);
- levelLabel.setText('Level ' + (currentLevelID + 1));
- placeOutliers();
- GAME_STATE = -1;
+ if (showingLevelCompleteCounter == 0) {
+ showingLevelCompleteCounter++;
+ // show level complete screen.
+ levelCompleteScreen = new LevelComplete();
+ levelCompleteScreen.x = 1024;
+ levelCompleteScreen.y = boardCenterY;
+ game.addChild(levelCompleteScreen);
+ // Add fireworks explosion effect
+ for (var i = 0; i < 10; i++) {
+ var firework = new Star(1024, boardCenterY, Math.random() * 2048, Math.random() * 2732, i * 100, 0xFFFFFF);
+ game.addChild(firework);
+ }
+ } else if (showingLevelCompleteCounter < showingLevelCompleteCounterMax) {
+ showingLevelCompleteCounter++;
+ } else {
+ //TODO: remove levelcomplete screen and stat next level.
+ levelCompleteScreen.destroy();
+ currentLevelID++;
+ //currentLevel = levels[currentLevelID].slice(0);
+ currentLevel = levels[currentLevelID].map(function (arr) {
+ return arr.slice();
+ });
+ console.log('new level is', currentLevel);
+ gridSize = currentLevel.length;
+ tileSize = calculateTileSize();
+ board.destroy();
+ board = new Board();
+ board.x = 1024;
+ board.y = boardCenterY; //2732 / 2;
+ game.addChild(board);
+ levelContainer.destroy();
+ levelContainer = new Container();
+ levelContainer.x = 1024;
+ levelContainer.y = boardCenterY; //2732 / 2;
+ game.addChild(levelContainer);
+ //levelContainer = new Container();
+ paintLevel(currentLevel);
+ levelLabel.setText('Level ' + (currentLevelID + 1));
+ placeOutliers();
+ GAME_STATE = -1;
+ }
} else {
//TODO: Show game over - all levels completed!
}
} else if (GAME_STATE == 5) {
A large calm background drawing for a puzzle game, in dark calm blueish colors and non-confusing content. High definition. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A quadratic polished dark blue marble slate. Front perspective with right angles. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A white question mark in a circle, like for a help button in a game.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A white X in a circle, like for a close window button in a game. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A white questionmark on a black background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A green check mark on a dark background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.