User prompt
make it multiplications more rare and fix multiplications backgrounds is blocks, make it multiplications is different blocks like others
User prompt
fix too many block spawn bug
User prompt
Make 2x 5x 10x 25x 50x 100x assest spawn randomly. But make it rare like 2x spawn %20, 5x %5, 10x %2, 25x %0.5, 50x %0.1, 100x %0.02. If thats spawn and here a match they multiplication the current win. Like 2x make it 2xcurrent win, 5x make it 5xcurrent win etc.
User prompt
add 6 new assets make names "x2" "x5" "x10" "x25" "x50" "x100"
User prompt
make a different new score bar and put it up to 5x5 line. Put new bar's left "Current Win:" text and put the left old score bar "Total Score" text
User prompt
change match limit 5 to 6
User prompt
Make game over screen when we have lower than 500 score. If game done but we have more than 500 score we can spin and play more with scores
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(spinBtnTxt, {' Line Number: 555
User prompt
Make we start with 2000 score and every spin cost 500 score. Game dont start automatic only start when we click spin button. And when we have lower than 500 score give game over screen
User prompt
Remove spin text
User prompt
Please remove blocks dont removing bug and fix the score bar
User prompt
Please fix the bug: 'null is not an object (evaluating 'scoreBarBg.x')' in or related to this line: 'scoreBarFill.x = scoreBarBg.x;' Line Number: 216
User prompt
Please fix the bug: 'null is not an object (evaluating 'scoreBarText.setText')' in or related to this line: 'scoreBarText.setText(score);' Line Number: 212
User prompt
Please fix the bug: 'null is not an object (evaluating 'scoreBarText.setText')' in or related to this line: 'scoreBarText.setText(score);' Line Number: 212
User prompt
Please fix the bug: 'target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(scoreBarFill, {' Line Number: 195 βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'null is not an object (evaluating 'scoreTxt.setText')' in or related to this line: 'scoreTxt.setText(score);' Line Number: 400
User prompt
put score bar below 5x5 line
User prompt
remove below 5x5 line background and put calculating score bar to here
User prompt
Make it every spin random 5x5 block spawn
User prompt
Please fix the bug: 'null is not an object (evaluating 'block.genus')' in or related to this line: 'if (block) {' Line Number: 263
User prompt
Please fix the bug: 'null is not an object (evaluating 'block.genus')' in or related to this line: 'genusBlocks[block.genus].push(block);' Line Number: 263
User prompt
Make it only 1 block spawn per 1x1 line every spin
User prompt
change 7 match limit to 5
User prompt
Put into calculating score bar text numbers into below 5x5 line
User prompt
make a calculating score bar and put into below background the 5x5 line
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Block class: represents a single block in the grid var Block = Container.expand(function () { var self = Container.call(this); // Properties self.genus = 0; // 0-7 self.gridX = 0; // 0-4 self.gridY = 0; // 0-4 // Asset for the block var blockAsset = null; // Set genus and update asset self.setGenus = function (genus) { self.genus = genus; // Remove old asset if present if (blockAsset) { self.removeChild(blockAsset); } // Each genus gets a unique color and shape var colors = [0xffffff, // white 0x222222, // black 0xffeb3b, // yellow 0xff9800, // orange 0x2196f3, // blue 0x4caf50, // green 0x9c27b0, // purple 0xf44336 // red ]; var shapes = ['box', 'ellipse', 'box', 'ellipse', 'box', 'ellipse', 'box', 'ellipse']; blockAsset = self.attachAsset('block_genus_' + genus, { width: blockSize, height: blockSize, color: colors[genus], shape: shapes[genus], anchorX: 0.5, anchorY: 0.5 }); }; // Animate breaking self.breakAnim = function (_onFinish) { tween(self, { scaleX: 1.3, scaleY: 1.3, alpha: 0 }, { duration: 200, easing: tween.cubicOut, onFinish: function onFinish() { self.scaleX = 1; self.scaleY = 1; self.alpha = 1; if (_onFinish) _onFinish(); } }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x222222 }); /**** * Game Code ****/ // red, ellipse // purple, box // green, ellipse // blue, box // orange, ellipse // yellow, box // black, ellipse // white, box // 8 unique block assets for 8 genus types // --- Constants --- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } var gridSize = 5; var genusCount = 8; var blockSize = 210; // Increased block size for bigger blocks var gridPadding = 22; // Slightly increased padding for visual separation var gridTotalSize = blockSize * gridSize + gridPadding * (gridSize - 1); var gridStartX = Math.floor((2048 - gridTotalSize) / 2) + blockSize / 2; var gridStartY = 400 + blockSize / 2; // leave space for Spin button // --- Fire Effect Background removed --- // --- Background Square (slightly smaller than the 5x5 grid area) --- var bgSquareWidth = gridTotalSize + 12; // background is a bit bigger than grid, but not overflowing var bgSquareHeight = gridTotalSize + 12; var bgSquareX = 2048 / 2; var bgSquareY = gridStartY + gridTotalSize / 2 - blockSize / 2; var bgSquare = LK.getAsset('background_square', { width: bgSquareWidth, height: bgSquareHeight, color: 0x181818, shape: 'box', anchorX: 0.5, anchorY: 0.5, x: bgSquareX, y: bgSquareY }); bgSquare.alpha = 0.92; game.addChild(bgSquare); // --- Score Bar UI (below the 5x5 line, where below_5x5_rect was) --- var scoreBarWidth = 320; var scoreBarHeight = 110; var scoreBarMax = 5000; // Arbitrary max for full bar, can be tuned var scoreBarY = bgSquareY + bgSquareHeight / 2 + 12 + 40; // 12px gap below bg, then 40px (half of old below_5x5_rect height) var scoreBarBg = LK.getAsset('score_bar_bg', { width: scoreBarWidth, height: scoreBarHeight, color: 0x333333, shape: 'box', anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: scoreBarY }); game.addChild(scoreBarBg); // Score bar fill (animated, colored, inside the smaller bar) var scoreBarFill = LK.getAsset('score_bar_fill', { width: 1, height: scoreBarHeight - 20, color: 0x4caf50, shape: 'box', anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: scoreBarY }); game.addChild(scoreBarFill); // Score bar text (centered inside the bar, on top of background) var scoreBarText = new Text2('0', { size: 90, fill: 0xffffff }); scoreBarText.anchor.set(0.5, 0.5); // Place the score text inside the score bar, slightly lower to center visually scoreBarText.x = scoreBarBg.x; scoreBarText.y = scoreBarBg.y; game.addChild(scoreBarText); // (scoreTxt is now handled by scoreBarText above) scoreTxt = scoreBarText; // --- Rainbow Square Background removed --- // --- State --- var grid = []; // 2D array [y][x] of Block var score = 0; var isSpinning = false; // --- UI Elements --- var spinBtn = null; // --- Score Bar UI --- // (All score bar variables are now initialized above, right after bgSquare) // Helper to update score bar fill and text function updateScoreBar() { var fillRatio = Math.min(score / scoreBarMax, 1); var targetWidth = Math.floor((scoreBarWidth - 24) * fillRatio); // Animate fill width if (scoreBarFill && _typeof(scoreBarFill) === "object") { tween(scoreBarFill, { width: targetWidth }, { duration: 180, easing: tween.cubicOut }); } if (scoreBarText) scoreBarText.setText(score); // Ensure fill stays centered in the bar as width animates if (scoreBarBg && scoreBarFill) { scoreBarFill.x = scoreBarBg.x; scoreBarFill.y = scoreBarBg.y; } if (scoreBarBg && scoreBarText) { scoreBarText.x = scoreBarBg.x; scoreBarText.y = scoreBarBg.y; } } // --- Helper Functions --- // Generate a random genus (0-7) function randomGenus() { return Math.floor(Math.random() * genusCount); } // Place a block at grid[x][y] function placeBlock(x, y, genus) { var block = new Block(); block.setGenus(genus); block.gridX = x; block.gridY = y; block.x = gridStartX + x * (blockSize + gridPadding); block.y = gridStartY + y * (blockSize + gridPadding); block.scaleX = 1; block.scaleY = 1; block.alpha = 1; game.addChild(block); return block; } // Remove a block from the game and grid function removeBlock(block) { if (block) { block.destroy(); } } // Fill the grid with random blocks, destroying old ones function fillGridRandom() { // Remove old blocks for (var y = 0; y < gridSize; y++) { for (var x = 0; x < gridSize; x++) { if (grid[y][x]) { removeBlock(grid[y][x]); } } } // Fill with new random blocks for every cell in the 5x5 grid for (var y = 0; y < gridSize; y++) { for (var x = 0; x < gridSize; x++) { var genus = randomGenus(); var block = placeBlock(x, y, genus); block.scaleX = 0.2; block.scaleY = 0.2; block.alpha = 0.2; tween(block, { scaleX: 1, scaleY: 1, alpha: 1 }, { duration: 220, easing: tween.cubicOut }); grid[y][x] = block; } } } // Find all genus with 7 or more blocks, return array of {genus, blocks: [Block]} function findMatches() { // Count blocks per genus var genusBlocks = []; for (var g = 0; g < genusCount; g++) { genusBlocks[g] = []; } for (var y = 0; y < gridSize; y++) { for (var x = 0; x < gridSize; x++) { var block = grid[y][x]; if (block && typeof block.genus === "number" && block.genus >= 0 && block.genus < genusCount) { genusBlocks[block.genus].push(block); } } } var matches = []; for (var g = 0; g < genusCount; g++) { if (genusBlocks[g].length >= 6) { matches.push({ genus: g, blocks: genusBlocks[g] }); } } return matches; } // Break all matched blocks, animate, update score, and refill function breakAndRefill(matches, _onFinish2) { if (matches.length === 0) { if (_onFinish2) _onFinish2(); return; } var blocksToBreak = []; for (var i = 0; i < matches.length; i++) { blocksToBreak = blocksToBreak.concat(matches[i].blocks); } // Remove duplicates (shouldn't be any, but just in case) var uniqueBlocks = []; var seen = {}; for (var i = 0; i < blocksToBreak.length; i++) { var b = blocksToBreak[i]; var key = b.gridX + ',' + b.gridY; if (!seen[key]) { uniqueBlocks.push(b); seen[key] = true; } } // Animate breaking var brokenCount = 0; for (var i = 0; i < uniqueBlocks.length; i++) { (function (block) { block.breakAnim(function () { // Remove from grid grid[block.gridY][block.gridX] = null; removeBlock(block); brokenCount++; // When all blocks are broken, refill if (brokenCount === uniqueBlocks.length) { // Update score: 10 points per block, +10 per extra block above 6, * genus+1 for (var m = 0; m < matches.length; m++) { var count = matches[m].blocks.length; var genus = matches[m].genus; // --- Sometimes give low scores: 30% chance to halve the score for this break --- var baseScore = (10 * count + 10 * Math.max(0, count - 6)) * (genus + 1); if (Math.random() < 0.3) { baseScore = Math.floor(baseScore * 0.5); } score += baseScore; } updateScore(); // Refill broken blocks with new random blocks var dropAnimCount = 0; var dropAnimTotal = 0; for (var y = 0; y < gridSize; y++) { for (var x = 0; x < gridSize; x++) { if (!grid[y][x]) { var genus = randomGenus(); var newBlock = placeBlock(x, y, genus); grid[y][x] = newBlock; // Animate drop from above var targetY = newBlock.y; newBlock.y = targetY - 180; dropAnimTotal++; tween(newBlock, { y: targetY }, { duration: 220, easing: tween.cubicOut, onFinish: function onFinish() { dropAnimCount++; // Only proceed after all drop animations are done if (dropAnimCount === dropAnimTotal) { // After refill, check for new matches recursively // --- BREAK COOLDOWN: Wait before checking for new matches --- LK.setTimeout(function () { var newMatches = findMatches(); if (newMatches.length > 0) { breakAndRefill(newMatches, _onFinish2); } else { if (_onFinish2) _onFinish2(); } }, 320); // 320ms cooldown after drop } } }); } } } // If no blocks needed to drop, continue immediately if (dropAnimTotal === 0) { // --- BREAK COOLDOWN: Wait before checking for new matches --- LK.setTimeout(function () { var newMatches = findMatches(); if (newMatches.length > 0) { breakAndRefill(newMatches, _onFinish2); } else { if (_onFinish2) _onFinish2(); } }, 320); // 320ms cooldown if no drop } // After refill, check for new matches recursively // (removed duplicate immediate check) } }); })(uniqueBlocks[i]); } } // Update score text and LK score function updateScore() { LK.setScore(score); if (scoreBarText) scoreBarText.setText(score); // Update score bar if (typeof updateScoreBar === "function") updateScoreBar(); // Optionally, animate score text for feedback if (scoreBarText) { tween(scoreBarText, { scaleX: 1.18, scaleY: 1.18 }, { duration: 80, easing: tween.cubicOut, onFinish: function onFinish() { tween(scoreBarText, { scaleX: 1, scaleY: 1 }, { duration: 80, easing: tween.cubicIn }); } }); } } // Check if any matches are possible (i.e., if any genus has 6+ blocks) function hasMatches() { var matches = findMatches(); return matches.length > 0; } // Handle Spin button press function onSpin() { if (isSpinning) return; if (score < 500) { // Not enough score to spin, show game over LK.effects.flashScreen(0x000000, 600); LK.showGameOver(); return; } score -= 500; updateScore(); isSpinning = true; // Animate all blocks out (optional, for feedback) for (var y = 0; y < gridSize; y++) { for (var x = 0; x < gridSize; x++) { var block = grid[y][x]; if (block) { tween(block, { scaleX: 0.7, scaleY: 0.7, alpha: 0.3 }, { duration: 120, easing: tween.cubicIn }); } } } // Remove cooldown for first spin, add cooldown only after first break if (typeof onSpin.firstSpin === "undefined") { onSpin.firstSpin = true; } var doSpin = function doSpin() { fillGridRandom(); // After refill, check for matches and break recursively var matches = findMatches(); if (matches.length > 0) { // Wrap breakAndRefill to add 3s cooldown after first break breakAndRefill(matches, function () { isSpinning = false; // After all matches, check if any more matches are possible if (!hasMatches()) { // Only show game over if score is less than 500, otherwise allow player to spin again if (score < 500) { LK.effects.flashScreen(0x000000, 600); LK.showGameOver(); } } }); } else { isSpinning = false; // If no matches at all, only show game over if score is less than 500 if (score < 500) { LK.effects.flashScreen(0x000000, 600); LK.showGameOver(); } } }; if (onSpin.firstSpin) { // No cooldown for first spin onSpin.firstSpin = false; LK.setTimeout(function () { doSpin(); }, 180); } else { // Add 3 second cooldown after first break LK.setTimeout(function () { LK.setTimeout(function () { doSpin(); }, 180); }, 3000); } } // --- UI Setup --- // Spin Button (circular, below the grid) var spinBtnRadius = 140; spinBtn = LK.getAsset('spinBtn', { width: spinBtnRadius * 2, height: spinBtnRadius * 2, color: 0xf9dd57, shape: 'ellipse', anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: gridStartY + gridTotalSize + spinBtnRadius + 60 // moved below the grid }); game.addChild(spinBtn); // Spin Button Text removed // --- Input Handling --- // Only allow pressing Spin button (not grid) spinBtn.down = function (x, y, obj) { if (isSpinning) return; onSpin(); // Animate button press tween(spinBtn, { scaleX: 0.92, scaleY: 0.92 }, { duration: 60, easing: tween.cubicIn, onFinish: function onFinish() { tween(spinBtn, { scaleX: 1, scaleY: 1 }, { duration: 80, easing: tween.cubicOut }); } }); // Removed spinBtnTxt animation as spinBtnTxt does not exist }; // --- Game Initialization --- // Initialize grid array for (var y = 0; y < gridSize; y++) { grid[y] = []; for (var x = 0; x < gridSize; x++) { grid[y][x] = null; } } // Start with 2000 score, do not fill grid or break until spin is pressed score = 2000; updateScore(); // Do not fillGridRandom or breakAndRefill here; wait for spin button // --- Game Update Loop (not used, but required for LK) --- game.update = function () { // No per-frame logic needed };
===================================================================
--- original.js
+++ change.js
@@ -266,9 +266,9 @@
}
}
var matches = [];
for (var g = 0; g < genusCount; g++) {
- if (genusBlocks[g].length >= 5) {
+ if (genusBlocks[g].length >= 6) {
matches.push({
genus: g,
blocks: genusBlocks[g]
});
@@ -307,14 +307,14 @@
removeBlock(block);
brokenCount++;
// When all blocks are broken, refill
if (brokenCount === uniqueBlocks.length) {
- // Update score: 10 points per block, +10 per extra block above 5, * genus+1
+ // Update score: 10 points per block, +10 per extra block above 6, * genus+1
for (var m = 0; m < matches.length; m++) {
var count = matches[m].blocks.length;
var genus = matches[m].genus;
// --- Sometimes give low scores: 30% chance to halve the score for this break ---
- var baseScore = (10 * count + 10 * Math.max(0, count - 5)) * (genus + 1);
+ var baseScore = (10 * count + 10 * Math.max(0, count - 6)) * (genus + 1);
if (Math.random() < 0.3) {
baseScore = Math.floor(baseScore * 0.5);
}
score += baseScore;
@@ -402,9 +402,9 @@
}
});
}
}
-// Check if any matches are possible (i.e., if any genus has 5+ blocks)
+// Check if any matches are possible (i.e., if any genus has 6+ blocks)
function hasMatches() {
var matches = findMatches();
return matches.length > 0;
}
doner. 2d. High contrast. No shadows
ayran. 2d. High contrast. No shadows
lettuce. 2d. High contrast. No shadows
tomato. 2d. High contrast. No shadows
beef. 2d. High contrast. No shadows
ketchup. 2d. High contrast. No shadows
purple cabbage. 2d. High contrast. No shadows
mayonnaise. 2d. High contrast. No shadows
return symbol
doner kebab master. 2d. Like doner store background
Mustard Bottle, label is x2. In-Game asset. 2d. High contrast. No shadows
Mustard Bottle, label is x5. In-Game asset. 2d. High contrast. No shadows
Mustard Bottle, label is x10. In-Game asset. 2d. High contrast. No shadows
Mustard Bottle, label is x25. In-Game asset. 2d. High contrast. No shadows
Mustard Bottle, label is x50. In-Game asset. 2d. High contrast. No shadows
Mustard Bottle, label is x100. In-Game asset. 2d. High contrast. No shadows
crushed mustard bottle. In-Game asset. 2d. High contrast. No shadows