User prompt
remove cool down Once you buy and use the powerful bomb you are sold again ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Cooldown should be 45 seconds
User prompt
ALLOW 45 SECONDS TO USE THE POWERFUL BOMB ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Coin counter also take it down
User prompt
add money candy to the game and when you click on it you will get +5 money and add money counter and add shop under that screen and let's buy a stronger bomb from there and it will explode a 5x5 area But let's select the area it will explode by clicking on it. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Move all the candies down a little bit
User prompt
If we explode more than 5, we will get a power up. and random 5x5 explode the ground and earn points when you explode Let's say the bomb is a candy and explode it by just touching it and it will explode a 3x3 area.
User prompt
Don't let the candies explode on their own, let us touch them and make them explode
Code edit (1 edits merged)
Please save this source code
User prompt
Candy Blast Chain
Initial prompt
Make me candy crush SO THAT NOTHING IS MISSING BUT INSTEAD OF MATCHING, LET'S CLICK ON 3 OR MORE CANDIES SIDE BY SIDE AND MAKE THEM EXPLODES BUT ONLY THE SAME COLORS EXPLODES AND EARN POINTS
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { money: 0, strongBombUnlocked: false }); /**** * Classes ****/ var Candy = Container.expand(function (colorType) { var self = Container.call(this); self.colorType = colorType; self.isSelected = false; self.isExploding = false; var candyAssets = ['candy_red', 'candy_blue', 'candy_green', 'candy_yellow', 'candy_purple', 'candy_orange', 'candy_bomb', 'candy_money']; var candyGraphics = self.attachAsset(candyAssets[colorType], { anchorX: 0.5, anchorY: 0.5 }); self.setSelected = function (selected) { self.isSelected = selected; if (selected) { candyGraphics.scaleX = 1.2; candyGraphics.scaleY = 1.2; } else { candyGraphics.scaleX = 1.0; candyGraphics.scaleY = 1.0; } }; self.explode = function () { self.isExploding = true; tween(candyGraphics, { scaleX: 1.5, scaleY: 1.5, alpha: 0 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); var Grid = Container.expand(function () { var self = Container.call(this); self.gridWidth = 8; self.gridHeight = 12; self.cellSize = 130; self.candies = []; self.selectedGroup = []; self.isAnimating = false; // Initialize grid array for (var i = 0; i < self.gridHeight; i++) { self.candies[i] = []; for (var j = 0; j < self.gridWidth; j++) { self.candies[i][j] = null; } } self.getGridPosition = function (x, y) { var startX = (2048 - self.gridWidth * self.cellSize) / 2; var startY = 300; var col = Math.floor((x - startX) / self.cellSize); var row = Math.floor((y - startY) / self.cellSize); return { row: row, col: col }; }; self.getWorldPosition = function (row, col) { var startX = (2048 - self.gridWidth * self.cellSize) / 2; var startY = 300; return { x: startX + col * self.cellSize + self.cellSize / 2, y: startY + row * self.cellSize + self.cellSize / 2 }; }; self.createCandy = function (row, col) { var colorType; // 5% chance for money candy if (Math.random() < 0.05) { colorType = 7; // Money candy } else { colorType = Math.floor(Math.random() * 6); } var candy = new Candy(colorType); var pos = self.getWorldPosition(row, col); candy.x = pos.x; candy.y = pos.y; self.candies[row][col] = candy; self.addChild(candy); return candy; }; self.fillGrid = function () { for (var i = 0; i < self.gridHeight; i++) { for (var j = 0; j < self.gridWidth; j++) { if (!self.candies[i][j]) { self.createCandy(i, j); } } } }; self.findConnectedGroup = function (row, col, colorType, visited) { if (row < 0 || row >= self.gridHeight || col < 0 || col >= self.gridWidth) { return []; } if (visited[row][col] || !self.candies[row][col] || self.candies[row][col].colorType !== colorType) { return []; } visited[row][col] = true; var group = [{ row: row, col: col, candy: self.candies[row][col] }]; // Check adjacent cells (up, down, left, right) var directions = [[-1, 0], [1, 0], [0, -1], [0, 1]]; for (var d = 0; d < directions.length; d++) { var newRow = row + directions[d][0]; var newCol = col + directions[d][1]; var connected = self.findConnectedGroup(newRow, newCol, colorType, visited); group = group.concat(connected); } return group; }; self.selectGroup = function (row, col) { if (self.isAnimating || !self.candies[row][col]) return; // Clear previous selection self.clearSelection(); var visited = []; for (var i = 0; i < self.gridHeight; i++) { visited[i] = []; for (var j = 0; j < self.gridWidth; j++) { visited[i][j] = false; } } var colorType = self.candies[row][col].colorType; self.selectedGroup = self.findConnectedGroup(row, col, colorType, visited); if (self.selectedGroup.length >= 3) { for (var i = 0; i < self.selectedGroup.length; i++) { self.selectedGroup[i].candy.setSelected(true); } return true; } else { self.selectedGroup = []; return false; } }; self.clearSelection = function () { for (var i = 0; i < self.selectedGroup.length; i++) { if (self.selectedGroup[i].candy && !self.selectedGroup[i].candy.isExploding) { self.selectedGroup[i].candy.setSelected(false); } } self.selectedGroup = []; }; self.explodeBomb = function (row, col) { if (!self.candies[row][col] || self.candies[row][col].colorType !== 6) return 0; self.isAnimating = true; var points = 0; var bombsToExplode = []; // Explode 3x3 area around bomb for (var i = -1; i <= 1; i++) { for (var j = -1; j <= 1; j++) { var newRow = row + i; var newCol = col + j; if (newRow >= 0 && newRow < self.gridHeight && newCol >= 0 && newCol < self.gridWidth) { if (self.candies[newRow][newCol]) { bombsToExplode.push({ row: newRow, col: newCol, candy: self.candies[newRow][newCol] }); points += 10; } } } } // Explode all candies in the bomb area for (var i = 0; i < bombsToExplode.length; i++) { var item = bombsToExplode[i]; self.candies[item.row][item.col] = null; item.candy.explode(); } LK.getSound('explode').play(); // Apply gravity and spawn new candies after explosion animation LK.setTimeout(function () { self.applyGravity(); }, 350); return points; }; self.explodeStrongBomb = function (row, col) { self.isAnimating = true; var points = 0; var bombsToExplode = []; // Explode 5x5 area around selected position for (var i = -2; i <= 2; i++) { for (var j = -2; j <= 2; j++) { var newRow = row + i; var newCol = col + j; if (newRow >= 0 && newRow < self.gridHeight && newCol >= 0 && newCol < self.gridWidth) { if (self.candies[newRow][newCol]) { bombsToExplode.push({ row: newRow, col: newCol, candy: self.candies[newRow][newCol] }); points += 15; } } } } // Explode all candies in the bomb area for (var i = 0; i < bombsToExplode.length; i++) { var item = bombsToExplode[i]; self.candies[item.row][item.col] = null; item.candy.explode(); } LK.getSound('explode').play(); // Apply gravity and spawn new candies after explosion animation LK.setTimeout(function () { self.applyGravity(); }, 350); return points; }; self.explodeSelectedGroup = function () { if (self.selectedGroup.length < 3) return 0; self.isAnimating = true; var points = self.selectedGroup.length * 10; var shouldCreateBomb = false; // Bonus points for larger groups if (self.selectedGroup.length >= 5) { points += 50; shouldCreateBomb = true; } if (self.selectedGroup.length >= 7) { points += 100; } // Explode candies for (var i = 0; i < self.selectedGroup.length; i++) { var item = self.selectedGroup[i]; self.candies[item.row][item.col] = null; item.candy.explode(); } LK.getSound('explode').play(); // Create bomb if 5 or more candies exploded if (shouldCreateBomb && self.selectedGroup.length > 0) { var bombRow = self.selectedGroup[0].row; var bombCol = self.selectedGroup[0].col; LK.setTimeout(function () { var bomb = new Candy(6); // Bomb candy type var pos = self.getWorldPosition(bombRow, bombCol); bomb.x = pos.x; bomb.y = pos.y; self.candies[bombRow][bombCol] = bomb; self.addChild(bomb); }, 100); } // Apply gravity and spawn new candies after explosion animation LK.setTimeout(function () { self.applyGravity(); }, 350); self.selectedGroup = []; return points; }; self.applyGravity = function () { var moved = false; // Move candies down for (var col = 0; col < self.gridWidth; col++) { for (var row = self.gridHeight - 1; row >= 0; row--) { if (!self.candies[row][col]) { // Find candy above to move down for (var searchRow = row - 1; searchRow >= 0; searchRow--) { if (self.candies[searchRow][col]) { self.candies[row][col] = self.candies[searchRow][col]; self.candies[searchRow][col] = null; var newPos = self.getWorldPosition(row, col); tween(self.candies[row][col], { x: newPos.x, y: newPos.y }, { duration: 200, easing: tween.easeIn }); moved = true; break; } } } } } // Fill empty spaces at top for (var col = 0; col < self.gridWidth; col++) { for (var row = 0; row < self.gridHeight; row++) { if (!self.candies[row][col]) { var candy = self.createCandy(row, col); // Start candy above screen and animate down candy.y = self.getWorldPosition(row, col).y - 500; var targetPos = self.getWorldPosition(row, col); tween(candy, { y: targetPos.y }, { duration: 300, easing: tween.easeOut }); } } } if (moved) { LK.getSound('cascade').play(); } // Check for chain reactions LK.setTimeout(function () { self.checkChainReactions(); }, 400); }; self.checkChainReactions = function () { // Simply finish the animation process without auto-exploding self.isAnimating = false; self.checkGameOver(); }; self.checkGameOver = function () { var visited = []; for (var i = 0; i < self.gridHeight; i++) { visited[i] = []; for (var j = 0; j < self.gridWidth; j++) { visited[i][j] = false; } } for (var row = 0; row < self.gridHeight; row++) { for (var col = 0; col < self.gridWidth; col++) { if (!visited[row][col] && self.candies[row][col]) { var group = self.findConnectedGroup(row, col, self.candies[row][col].colorType, visited); if (group.length >= 3) { return; // Game can continue } } } } // No valid moves left LK.setTimeout(function () { LK.showGameOver(); }, 1000); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2E1065 }); /**** * Game Code ****/ var grid = game.addChild(new Grid()); var scoreTxt = new Text2('0', { size: 120, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); scoreTxt.y = 50; // Initialize score LK.setScore(0); scoreTxt.setText(LK.getScore().toString()); // Fill initial grid grid.fillGrid(); // Title text var titleTxt = new Text2('Candy Blast Chain', { size: 100, fill: 0xFFD700 }); titleTxt.anchor.set(0.5, 0); titleTxt.x = 2048 / 2; titleTxt.y = 50; game.addChild(titleTxt); // Instructions text var instructionsTxt = new Text2('Tap groups of 3+ same colored candies!', { size: 60, fill: 0xFFFFFF }); instructionsTxt.anchor.set(0.5, 0); instructionsTxt.x = 2048 / 2; instructionsTxt.y = 120; game.addChild(instructionsTxt); // Money counter var moneyTxt = new Text2('Money: ' + (storage.money || 0), { size: 80, fill: 0xFFD700 }); moneyTxt.anchor.set(0, 0); moneyTxt.x = 50; moneyTxt.y = 300; game.addChild(moneyTxt); // Shop UI var shopTxt = new Text2('SHOP', { size: 80, fill: 0xFFFFFF }); shopTxt.anchor.set(0.5, 0); shopTxt.x = 2048 / 2; shopTxt.y = 2400; game.addChild(shopTxt); var strongBombTxt = new Text2('Strong Bomb (Cost: 50)', { size: 60, fill: storage.strongBombUnlocked ? 0x00FF00 : 0xFFFFFF }); strongBombTxt.anchor.set(0.5, 0); strongBombTxt.x = 2048 / 2; strongBombTxt.y = 2500; game.addChild(strongBombTxt); var usingStrongBomb = false; var strongBombTimer = 0; var strongBombCooldown = 45000; // 45 seconds in milliseconds game.down = function (x, y, obj) { if (grid.isAnimating) return; // Check if clicked on shop area if (y >= 2400) { // Check if clicked on strong bomb purchase if (y >= 2500 && y <= 2600) { if (!storage.strongBombUnlocked && storage.money >= 50) { storage.money -= 50; storage.strongBombUnlocked = true; moneyTxt.setText('Money: ' + storage.money); strongBombTxt.setText('Strong Bomb (Unlocked!)'); strongBombTxt.fill = 0x00FF00; } else if (storage.strongBombUnlocked && !usingStrongBomb) { usingStrongBomb = true; strongBombTxt.setText('Select area to explode!'); strongBombTxt.fill = 0xFF0000; } } return; } var gridPos = grid.getGridPosition(x, y); if (gridPos.row >= 0 && gridPos.row < grid.gridHeight && gridPos.col >= 0 && gridPos.col < grid.gridWidth) { // Check if using strong bomb if (usingStrongBomb && storage.strongBombUnlocked) { var points = grid.explodeStrongBomb(gridPos.row, gridPos.col); LK.setScore(LK.getScore() + points); scoreTxt.setText(LK.getScore().toString()); usingStrongBomb = false; // Reset to purchasable state storage.strongBombUnlocked = false; strongBombTxt.setText('Strong Bomb (Cost: 50)'); strongBombTxt.fill = 0xFFFFFF; return; } // Check if clicked candy is money candy if (grid.candies[gridPos.row][gridPos.col] && grid.candies[gridPos.row][gridPos.col].colorType === 7) { // Give money and remove candy storage.money += 5; moneyTxt.setText('Money: ' + storage.money); grid.candies[gridPos.row][gridPos.col].explode(); grid.candies[gridPos.row][gridPos.col] = null; LK.setTimeout(function () { grid.applyGravity(); }, 350); return; } // Check if clicked candy is a bomb if (grid.candies[gridPos.row][gridPos.col] && grid.candies[gridPos.row][gridPos.col].colorType === 6) { // Explode bomb immediately var points = grid.explodeBomb(gridPos.row, gridPos.col); LK.setScore(LK.getScore() + points); scoreTxt.setText(LK.getScore().toString()); } else if (grid.selectGroup(gridPos.row, gridPos.col)) { // Valid group selected, explode on next tap LK.setTimeout(function () { if (grid.selectedGroup.length >= 3) { var points = grid.explodeSelectedGroup(); LK.setScore(LK.getScore() + points); scoreTxt.setText(LK.getScore().toString()); } }, 100); } } }; game.update = function () { // Timer logic removed - no cooldown needed };
===================================================================
--- original.js
+++ change.js
@@ -430,9 +430,9 @@
storage.strongBombUnlocked = true;
moneyTxt.setText('Money: ' + storage.money);
strongBombTxt.setText('Strong Bomb (Unlocked!)');
strongBombTxt.fill = 0x00FF00;
- } else if (storage.strongBombUnlocked && !usingStrongBomb && strongBombTimer <= 0) {
+ } else if (storage.strongBombUnlocked && !usingStrongBomb) {
usingStrongBomb = true;
strongBombTxt.setText('Select area to explode!');
strongBombTxt.fill = 0xFF0000;
}
@@ -446,11 +446,12 @@
var points = grid.explodeStrongBomb(gridPos.row, gridPos.col);
LK.setScore(LK.getScore() + points);
scoreTxt.setText(LK.getScore().toString());
usingStrongBomb = false;
- strongBombTimer = strongBombCooldown; // Start 45 second cooldown
- strongBombTxt.setText('Strong Bomb (Cooldown: 45s)');
- strongBombTxt.fill = 0xFF0000;
+ // Reset to purchasable state
+ storage.strongBombUnlocked = false;
+ strongBombTxt.setText('Strong Bomb (Cost: 50)');
+ strongBombTxt.fill = 0xFFFFFF;
return;
}
// Check if clicked candy is money candy
if (grid.candies[gridPos.row][gridPos.col] && grid.candies[gridPos.row][gridPos.col].colorType === 7) {
@@ -482,22 +483,6 @@
}
}
};
game.update = function () {
- // Update strong bomb timer
- if (strongBombTimer > 0) {
- strongBombTimer -= LK.dt;
- if (strongBombTimer <= 0) {
- strongBombTimer = 0;
- // Reset strong bomb availability
- if (storage.strongBombUnlocked) {
- strongBombTxt.setText('Strong Bomb (Unlocked!)');
- strongBombTxt.fill = 0x00FF00;
- }
- } else {
- // Show remaining time
- var remainingSeconds = Math.ceil(strongBombTimer / 1000);
- strongBombTxt.setText('Strong Bomb (Cooldown: ' + remainingSeconds + 's)');
- strongBombTxt.fill = 0xFF0000;
- }
- }
+ // Timer logic removed - no cooldown needed
};
\ No newline at end of file
uncut watermelon. In-Game asset. 2d. High contrast. No shadows
Coin. In-Game asset. 2d. High contrast. No shadows
uncut lemon. In-Game asset. 2d. High contrast. No shadows
Uncut orange. In-Game asset. 2d. High contrast. No shadows
Uncut dragonfruit. In-Game asset. 2d. High contrast. No shadows
Strawberry. In-Game asset. 2d. High contrast. No shadows
Blueberry. In-Game asset. 2d. High contrast. No shadows
Bomb. In-Game asset. 2d. High contrast. No shadows
HORIZONTAL BLADE. In-Game asset. 2d. High contrast. No shadows