User prompt
make new assets blue total score bg and make it total score background
User prompt
move triangle bar of the below amount bar a bit down
User prompt
move triangle bar a bit down
User prompt
put triangle bar to total score bg
User prompt
Please fix the bug: 'undefined is not an object (evaluating 'triangle.y')' in or related to this line: 'scoreBarText.y = triangle.y + triangle.height / 2;' Line Number: 1418
User prompt
put total score amount into triangle bar below the amount bar
User prompt
make bar of the below amount bar more bigger, do it will cover below minus plus amount bar
User prompt
make bigger the bar of below the amount bar
User prompt
make a triangle assets and put to below amount bar
User prompt
Please fix the bug: 'Can't find variable: scoreBarFill' in or related to this line: 'if (scoreBarFill && _typeof(scoreBarFill) === "object") {' Line Number: 327
User prompt
Please fix the bug: 'undefined is not an object (evaluating 'spinAmountBtn.x')' in or related to this line: 'scoreBarText.x = spinAmountBtn.x;' Line Number: 318
User prompt
remove total score bg and put the text into other background
User prompt
Please fix the bug: 'undefined is not an object (evaluating 'spinBtnBorder.y')' in or related to this line: 'var scoreBarY = spinBtnBorder.y + spinBtnRadius + 80;' Line Number: 284
User prompt
put total score down
User prompt
put total score bar down spin amount button
User prompt
put total win bar and label below amount
User prompt
make current win bar smaller and put text into it
User prompt
fix current win and total win bar put them old position
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'updateSpinAmountText();' Line Number: 1507
User prompt
fix last things
User prompt
Please fix the bug: 'Can't find variable: winBarFill' in or related to this line: 'if (winBarFill && _typeof(winBarFill) === "object") {' Line Number: 470
User prompt
Please fix the bug: 'Can't find variable: winBarMax' in or related to this line: 'var winFillRatio = Math.min(currentWin / winBarMax, 1);' Line Number: 465
User prompt
put total amount button, minus plus amount button and arda buggy text same side and adjust the dimensions accordingly
User prompt
put minus plus amount button down outside 5x5 side
User prompt
put minus plus amount button outside of 5x5 side
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.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 ****/ // blue total score bg // (Moved after bgSquare is defined to avoid undefined error) // --- x: @ardabuggy text outside right down 5x5 grid --- // --- Game Initialization --- var donerTitleY = 120; var donerTitle = new Text2('DONER SPINNER', { size: 160, fill: 0xffffff, font: "Impact, 'Arial Black', Tahoma" }); donerTitle.anchor.set(0.5, 0.5); donerTitle.x = 2048 / 2; donerTitle.y = donerTitleY + 80; game.addChild(donerTitle); // --- Current Win Bar UI (above the 5x5 grid) --- // 8 unique block assets for 8 genus types // white, box // black, ellipse // yellow, box // orange, ellipse // blue, box // green, ellipse // purple, box // red, ellipse function _typeof2(o) { "@babel/helpers - typeof"; return _typeof2 = "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; }, _typeof2(o); } 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; // Add black border behind bgSquare var bgSquareBorder = LK.getAsset('score_bar_bg', { width: bgSquareWidth + 12, height: bgSquareHeight + 12, color: 0x000000, shape: 'box', anchorX: 0.5, anchorY: 0.5, x: bgSquareX, y: bgSquareY }); bgSquareBorder.alpha = 1; game.addChild(bgSquareBorder); 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); // --- x: @ardabuggy text, top right of grid --- var ardabuggyText = new Text2('x: @ardabuggy', { size: 54, fill: 0xffffff }); ardabuggyText.anchor.set(1, 0); // Place at top right of grid, with margin ardabuggyText.x = bgSquare.x + bgSquareWidth / 2 - 12; ardabuggyText.y = bgSquare.y - bgSquareHeight / 2 + 12; game.addChild(ardabuggyText); // --- Animate ardabuggyText color every second --- var ardabuggyColors = [0xffffff, 0xffeb3b, 0x30a262, 0xda4310, 0x0d24f3, 0x8973c8, 0xf9dd57, 0xd83318]; var ardabuggyColorIdx = 0; function cycleArdabuggyColor() { var nextIdx = (ardabuggyColorIdx + 1) % ardabuggyColors.length; var nextColor = ardabuggyColors[nextIdx]; tween(ardabuggyText, { tint: nextColor }, { duration: 600, easing: tween.cubicInOut, onFinish: function onFinish() { ardabuggyColorIdx = nextIdx; } }); } LK.setInterval(cycleArdabuggyColor, 1000); // --- Current Win Bar UI (above the 5x5 grid, centered) --- var currentWin = 0; var winBarMax = 5000; // Arbitrary max for full bar, can be tuned var winBarWidth = Math.floor(gridTotalSize * 0.45); // Make win bar smaller (45% of grid width) var winBarHeight = 48; // Smaller height for the win bar // Win bar background (above grid, centered) var winBarBg = LK.getAsset('score_bar_bg', { width: winBarWidth, height: winBarHeight, color: 0x333333, shape: 'box', anchorX: 0.5, anchorY: 0.5, x: bgSquare.x, y: bgSquare.y - bgSquareHeight / 2 - 60 }); game.addChild(winBarBg); // Win bar fill var winBarFill = LK.getAsset('score_bar_fill', { width: 1, height: winBarHeight - 12, color: 0xda4310, shape: 'box', anchorX: 0.0, anchorY: 0.5, x: winBarBg.x - winBarWidth / 2, y: winBarBg.y }); game.addChild(winBarFill); // Win bar text (currentWin) - now centered inside the bar var winBarText = new Text2(currentWin + '', { size: 38, fill: 0xffffff, font: "Impact, 'Arial Black', Tahoma" }); winBarText.anchor.set(0.5, 0.5); winBarText.x = winBarBg.x; winBarText.y = winBarBg.y; game.addChild(winBarText); // Win bar label (above win bar, smaller and centered) var winLabel = new Text2('Current Win', { size: 28, fill: 0xffffff }); winLabel.anchor.set(0.5, 1); winLabel.x = winBarBg.x; winLabel.y = winBarBg.y - winBarHeight / 2 - 8; game.addChild(winLabel); // --- Total Score Bar (below spin amount button, centered) --- var scoreBarWidth = 420; var scoreBarHeight = 80; var scoreBarMax = 5000; // Arbitrary max for full bar, can be tuned // --- Spin Button (circular, below the grid and spin amount UI) --- var spinBtnRadius = 140; // Add black border behind spinBtn var spinBtnBorder = LK.getAsset('score_bar_bg', { width: spinBtnRadius * 2 + 16, height: spinBtnRadius * 2 + 16, color: 0x000000, shape: 'ellipse', anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: gridStartY + gridTotalSize + spinBtnRadius + 260 }); game.addChild(spinBtnBorder); 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 + 260 // moved below the grid and spin amount UI }); game.addChild(spinBtn); // Place total win bar further down, below the spin button // Move total score text into spin amount button background, below spin amount text var scoreBarY = spinBtnBorder.y + spinBtnRadius + 80; // Remove total score bar backgrounds and fill, only show text and label // Place total score text inside spin amount button background, below spin amount text // (Moved below spinAmountBtn definition to avoid undefined error) // --- Rainbow Square Background removed --- // --- State --- var grid = []; // 2D array [y][x] of Block var score = 2000; 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() { // Total Score bar // (scoreBarFill and scoreBarBg have been removed, only update text) if (scoreBarText) scoreBarText.setText(score); // Current Win bar var winFillRatio = Math.min(currentWin / winBarMax, 1); var winTargetWidth = Math.floor((winBarWidth - 20) * winFillRatio); if (winBarFill && _typeof(winBarFill) === "object") { tween(winBarFill, { width: winTargetWidth }, { duration: 180, easing: tween.cubicOut }); } if (winBarText) winBarText.setText(currentWin); if (winBarBg && winBarFill) { winBarFill.x = winBarBg.x - winBarWidth / 2; winBarFill.y = winBarBg.y; } if (winBarBg && winBarText) { winBarText.x = winBarBg.x; winBarText.y = winBarBg.y; } // --- Fire effect and orange filter when currentWin > 1000 --- if (typeof updateScoreBar._fireEffectNode === "undefined") updateScoreBar._fireEffectNode = null; if (typeof updateScoreBar._orangeFilterNode === "undefined") updateScoreBar._orangeFilterNode = null; if (currentWin > 1000) { // Add fire effect if not already present if (!updateScoreBar._fireEffectNode) { var fireNode = LK.getAsset('fire_ellipse', { width: 900, height: 320, anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: winBarBg.y + winBarBg.height / 2 + 60 }); fireNode.alpha = 0.38; fireNode.scaleX = 1.2 + Math.random() * 0.2; fireNode.scaleY = 1.1 + Math.random() * 0.2; // Animate fireNode scale for a flicker effect tween(fireNode, { scaleX: 1.4, scaleY: 1.25 }, { duration: 320, easing: tween.cubicInOut, onFinish: function onFinish() { if (fireNode && fireNode.parent) { tween(fireNode, { scaleX: 1.2, scaleY: 1.1 }, { duration: 320, easing: tween.cubicInOut }); } } }); game.addChild(fireNode); updateScoreBar._fireEffectNode = fireNode; } // Add orange filter overlay if not already present if (!updateScoreBar._orangeFilterNode) { var orangeNode = LK.getAsset('score_bar_bg', { width: 2048, height: 2732, color: 0xffa040, shape: 'box', anchorX: 0, anchorY: 0, x: 0, y: 0 }); orangeNode.alpha = 0.13; // Ensure full screen coverage and overlay orangeNode.width = 2048; orangeNode.height = 2732; orangeNode.x = 0; orangeNode.y = 0; // Place on top of all game elements game.addChild(orangeNode); updateScoreBar._orangeFilterNode = orangeNode; } } else { // Remove fire effect if present if (updateScoreBar._fireEffectNode && updateScoreBar._fireEffectNode.destroy) { updateScoreBar._fireEffectNode.destroy(); updateScoreBar._fireEffectNode = null; } // Remove orange filter if present if (updateScoreBar._orangeFilterNode && updateScoreBar._orangeFilterNode.destroy) { updateScoreBar._orangeFilterNode.destroy(); updateScoreBar._orangeFilterNode = null; } } } // --- 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); // Add click handler to show genus breakdown window block.down = function (x, y, obj) { // Remove any existing breakdown window if (game._blockBreakdownWindow && game._blockBreakdownWindow.length) { for (var i = 0; i < game._blockBreakdownWindow.length; i++) { if (game._blockBreakdownWindow[i] && game._blockBreakdownWindow[i].destroy) game._blockBreakdownWindow[i].destroy(); } game._blockBreakdownWindow = []; } // Calculate genus count in grid var genusCountInGrid = 0; for (var yy = 0; yy < gridSize; yy++) { for (var xx = 0; xx < gridSize; xx++) { if (grid[yy][xx] && grid[yy][xx].genus === genus) genusCountInGrid++; } } // Calculate per block score var perBlockScore = Math.floor(4 * (genus + 1) * (spinAmount / 500)); // Window background var winW = 1000, winH = 600; // Center the window in the main screen var winX = (2048 - winW) / 2; var winY = (2732 - winH) / 2; var winBg = LK.getAsset('score_bar_bg', { width: winW, height: winH, color: 0x181818, shape: 'box', anchorX: 0, anchorY: 0, x: winX, y: winY }); winBg.alpha = 0.97; // Block icon var blockIcon = LK.getAsset('block_genus_' + genus, { width: 120, height: 120, anchorX: 0, anchorY: 0.5, x: winX + 48, y: winY + winH / 2 }); // Texts: "6x(score) = total", "7x(score) = total", etc, stacked under each other var breakdownTexts = []; var breakdownFontSize = 80; var breakdownSpacing = 18; // Always show breakdown lines for 6, 7, 8, 9, ... up to genusCountInGrid, but only if genusCountInGrid >= 6 if (genusCountInGrid >= 6) { var breakdownLineCount = genusCountInGrid - 6 + 1; var stackStartY = winY + winH / 2 - (breakdownLineCount - 1) * (breakdownFontSize + breakdownSpacing) / 2; for (var i = 6; i <= genusCountInGrid; i++) { var lineScore = i * perBlockScore; // Show: "6x <score per block> = <total>", e.g. "6x 120 = 720" var breakdownLine = new Text2(i + "x " + perBlockScore + " = " + lineScore, { size: breakdownFontSize, fill: 0xffffff }); breakdownLine.anchor.set(0, 0.5); breakdownLine.x = winX + 200; // Stack each line under the previous with spacing breakdownLine.y = stackStartY + (i - 6) * (breakdownFontSize + breakdownSpacing); game.addChild(breakdownLine); breakdownTexts.push(breakdownLine); } } // Title var titleText = new Text2("Block Genus " + genus, { size: 54, fill: 0xffeb3b }); titleText.anchor.set(0, 0); titleText.x = winX + 48; titleText.y = winY + 32; // Close button var closeBtn = LK.getAsset('score_bar_bg', { width: 80, height: 80, color: 0xd83318, shape: 'ellipse', anchorX: 0.5, anchorY: 0.5, x: winX + winW - 60, y: winY + 60 }); var closeTxt = new Text2('Γ', { size: 60, fill: 0xffffff }); closeTxt.anchor.set(0.5, 0.5); closeTxt.x = closeBtn.x; closeTxt.y = closeBtn.y; closeBtn.down = function () { if (game._blockBreakdownWindow && game._blockBreakdownWindow.length) { for (var i = 0; i < game._blockBreakdownWindow.length; i++) { if (game._blockBreakdownWindow[i] && game._blockBreakdownWindow[i].destroy) game._blockBreakdownWindow[i].destroy(); } game._blockBreakdownWindow = []; } }; // Add to game // Add all breakdown window elements to LK.gui.center to ensure they are above all game elements LK.gui.center.addChild(winBg); LK.gui.center.addChild(blockIcon); LK.gui.center.addChild(titleText); LK.gui.center.addChild(closeBtn); LK.gui.center.addChild(closeTxt); // Track for removal (include all breakdownTexts) var breakdownWindowNodes = [winBg, blockIcon, titleText, closeBtn, closeTxt]; for (var i = 0; i < breakdownTexts.length; i++) { LK.gui.center.addChild(breakdownTexts[i]); breakdownWindowNodes.push(breakdownTexts[i]); } game._blockBreakdownWindow = breakdownWindowNodes; }; 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 and clear grid for (var y = 0; y < gridSize; y++) { if (!grid[y]) grid[y] = []; for (var x = 0; x < gridSize; x++) { if (grid[y][x]) { removeBlock(grid[y][x]); } grid[y][x] = null; } } // Fill with new random blocks for every cell in the 5x5 grid for (var y = 0; y < gridSize; y++) { if (!grid[y]) grid[y] = []; for (var x = 0; x < gridSize; x++) { if (!grid[y][x]) { // Only fill empty cells // 1% chance to spawn a 5x block, 5% chance to spawn a 2x block (use special asset for each) var genus; var block; var rand = Math.random(); // Probabilities (cumulative): // x100: 0.002% (0.00002) // x50: 0.01% (0.0001) // x25: 0.03% (0.0003) // x10: 0.1% (0.001) // x5: 0.3% (0.003) // x2: 1% (0.01) // rest: normal if (rand < 0.00002) { // x100 block (0.002%) genus = 14; block = placeBlock(x, y, genus); if (block && block.children && block.children.length > 0) { block.removeChild(block.children[0]); } block.attachAsset('x100', { width: blockSize, height: blockSize, anchorX: 0.5, anchorY: 0.5 }); } else if (rand < 0.00012) { // x50 block (0.01%) genus = 13; block = placeBlock(x, y, genus); if (block && block.children && block.children.length > 0) { block.removeChild(block.children[0]); } block.attachAsset('x50', { width: blockSize, height: blockSize, anchorX: 0.5, anchorY: 0.5 }); } else if (rand < 0.00042) { // x25 block (0.03%) genus = 12; block = placeBlock(x, y, genus); if (block && block.children && block.children.length > 0) { block.removeChild(block.children[0]); } block.attachAsset('x25', { width: blockSize, height: blockSize, anchorX: 0.5, anchorY: 0.5 }); } else if (rand < 0.00142) { // x10 block (0.1%) genus = 11; block = placeBlock(x, y, genus); if (block && block.children && block.children.length > 0) { block.removeChild(block.children[0]); } block.attachAsset('x10', { width: blockSize, height: blockSize, anchorX: 0.5, anchorY: 0.5 }); } else if (rand < 0.00442) { // x5 block (0.3%) genus = 9; block = placeBlock(x, y, genus); if (block && block.children && block.children.length > 0) { block.removeChild(block.children[0]); } block.attachAsset('x5', { width: blockSize, height: blockSize, anchorX: 0.5, anchorY: 0.5 }); } else if (rand < 0.01442) { // x2 block (1%) genus = 8; block = placeBlock(x, y, genus); if (block && block.children && block.children.length > 0) { block.removeChild(block.children[0]); } block.attachAsset('x2', { width: blockSize, height: blockSize, anchorX: 0.5, anchorY: 0.5 }); } else { genus = randomGenus(); block = placeBlock(x, y, genus); } // --- Drop animation: start above, tween down --- var targetY = block.y; block.y = targetY - 180; tween(block, { y: targetY, 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++) { if (!grid[y]) grid[y] = []; for (var x = 0; x < gridSize; x++) { if (!grid[y]) grid[y] = []; 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 // --- Stacked breakdown text logic for fast breaks --- if (!breakAndRefill.activeBreakdowns) breakAndRefill.activeBreakdowns = []; var breakdownTextNodes = []; var breakdownFontSize = 44; var breakdownDuration = 1200; var breakdownFade = 400; // Arrange breakdowns vertically outside and to the right of the 5x5 grid var breakdownCellW = 140; var breakdownCellH = 84; // Increased for more vertical space between messages // Place to the right of the 5x5 grid, not under the score bar var breakdownStartX = bgSquare.x + bgSquareWidth / 2 + 60; var breakdownStartY = bgSquare.y - bgSquareHeight / 2; // Find the next available vertical slot for each new breakdown var usedRows = []; for (var b = 0; b < breakAndRefill.activeBreakdowns.length; b++) { var batch = breakAndRefill.activeBreakdowns[b]; for (var j = 0; j < batch.length; j += 2) { // asset is batch[j], text is batch[j+1] if (batch[j] && typeof batch[j].__breakdownRow === "number") { usedRows.push(batch[j].__breakdownRow); } } } for (var i = 0; i < matches.length; i++) { var genus = matches[i].genus; var count = matches[i].blocks.length; if (count >= 6) { // Find the next available row (vertical stacking) var row = 0; while (usedRows.indexOf(row) !== -1) { row++; } usedRows.push(row); var asset = LK.getAsset('block_genus_' + genus, { width: 54, height: 54, anchorX: 0, anchorY: 0.5, x: breakdownStartX, y: breakdownStartY + row * breakdownCellH }); asset.__breakdownRow = row; var perBlockScore = Math.floor(4 * (genus + 1) * (spinAmount / 500)); var extraBlockScore = Math.floor(2 * (genus + 1) * (spinAmount / 500)) * Math.max(0, count - 6); var totalScore = perBlockScore * count + extraBlockScore; var text = new Text2(count + "x" + perBlockScore + (count > 6 ? " + " + (count - 6) + "x" + perBlockScore : "") + " = " + totalScore, { size: breakdownFontSize, fill: 0xffffff }); text.anchor.set(0, 0.5); text.x = breakdownStartX + 60; text.y = breakdownStartY + row * breakdownCellH + 36; // Adjusted for new cell height game.addChild(asset); game.addChild(text); breakdownTextNodes.push(asset, text); } } // Track this batch for stacking breakAndRefill.activeBreakdowns.push(breakdownTextNodes); // Remove this batch after duration, and update stacking for remaining var breakdownClearTimeout = LK.setTimeout(function () { // Destroy this batch for (var i = 0; i < breakdownTextNodes.length; i++) { if (breakdownTextNodes[i] && breakdownTextNodes[i].destroy) breakdownTextNodes[i].destroy(); } // Remove this batch from activeBreakdowns var idx = breakAndRefill.activeBreakdowns.indexOf(breakdownTextNodes); if (idx !== -1) breakAndRefill.activeBreakdowns.splice(idx, 1); // Move up any remaining breakdowns (re-stack vertically) for (var b = 0; b < breakAndRefill.activeBreakdowns.length; b++) { var batch = breakAndRefill.activeBreakdowns[b]; // Find the new row for this batch (b) for (var j = 0; j < batch.length; j += 2) { // asset is batch[j], text is batch[j+1] if (batch[j]) { batch[j].y = breakdownStartY + b * breakdownCellH; batch[j].__breakdownRow = b; } if (batch[j + 1]) { batch[j + 1].y = breakdownStartY + b * breakdownCellH + 36; // Adjusted for new cell height } } } }, breakdownDuration + breakdownFade); var brokenCount = 0; for (var i = 0; i < uniqueBlocks.length; i++) { (function (block) { if (block.genus === 3) { LK.getSound('tomato').play(); } if (block.genus === 1) { LK.getSound('ayran').play(); } if (block.genus === 0) { LK.getSound('doner').play(); } if (block.genus === 4) { LK.getSound('meal').play(); } if (block.genus === 5) { LK.getSound('ketchup').play(); } if (block.genus === 6) { LK.getSound('cabbage').play(); } if (block.genus === 7) { LK.getSound('mayonaisse').play(); } if (block.genus === 2) { LK.getSound('lettuce').play(); } 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 var winScore = 0; // Collect all multipliers present in the grid (2x and 5x) var multipliers = []; for (var y2 = 0; y2 < gridSize; y2++) { for (var x2 = 0; x2 < gridSize; x2++) { if (grid[y2][x2]) { if (grid[y2][x2].genus === 8) multipliers.push(2); if (grid[y2][x2].genus === 9) multipliers.push(5); if (grid[y2][x2].genus === 11) multipliers.push(10); if (grid[y2][x2].genus === 12) multipliers.push(25); if (grid[y2][x2].genus === 13) multipliers.push(50); if (grid[y2][x2].genus === 14) multipliers.push(100); } } } // Remove duplicates (if multiple 2x or 5x, only count once each) var uniqueMultipliers = []; for (var i = 0; i < multipliers.length; i++) { if (uniqueMultipliers.indexOf(multipliers[i]) === -1) uniqueMultipliers.push(multipliers[i]); } var totalMultiplier = 1; if (uniqueMultipliers.length > 0) { // Sum all multipliers, e.g. 2x + 5x = 7x for (var i = 0; i < uniqueMultipliers.length; i++) { totalMultiplier += uniqueMultipliers[i] - 1; } } var has2xBlock = uniqueMultipliers.indexOf(2) !== -1; var has5xBlock = uniqueMultipliers.indexOf(5) !== -1; var has10xBlock = uniqueMultipliers.indexOf(10) !== -1; var has25xBlock = uniqueMultipliers.indexOf(25) !== -1; var has50xBlock = uniqueMultipliers.indexOf(50) !== -1; var has100xBlock = uniqueMultipliers.indexOf(100) !== -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 = (4 * count + 2 * Math.max(0, count - 6)) * (genus + 1); if (Math.random() < 0.3) { baseScore = Math.floor(baseScore * 0.5); } score += baseScore; winScore += baseScore; } // If any multiplier block is present, apply the summed multiplier and show a message if (totalMultiplier > 1 && winScore > 0) { var normalWinAmount = winScore; winScore = winScore * totalMultiplier; // Animate winBarText to indicate multiplier (color: purple if 5x, yellow if 2x, else white) var animScale = totalMultiplier >= 10 ? 1.8 : totalMultiplier >= 5 ? 1.6 : 1.4; var animTint = has100xBlock ? 0x30a262 : has50xBlock ? 0x0d24f3 : has25xBlock ? 0xda4310 : has10xBlock ? 0xf9dd57 : has5xBlock ? 0x8973c8 : has2xBlock ? 0xffeb3b : 0xffffff; tween(winBarText, { scaleX: animScale, scaleY: animScale, tint: animTint }, { duration: 200, easing: tween.cubicOut, onFinish: function onFinish() { tween(winBarText, { scaleX: 1, scaleY: 1, tint: 0xffffff }, { duration: 180, easing: tween.cubicIn }); } }); // Show data message for the combined multiplier var msgText = ""; if (uniqueMultipliers.length > 1) { msgText = uniqueMultipliers.join(" + ") + "x the current win"; } else { msgText = uniqueMultipliers[0] + "x the current win"; } var msgColor = has100xBlock ? 0x30a262 : has50xBlock ? 0x0d24f3 : has25xBlock ? 0xda4310 : has10xBlock ? 0xf9dd57 : has5xBlock ? 0x8973c8 : has2xBlock ? 0xffeb3b : 0xffffff; var msgSize = totalMultiplier >= 100 ? 60 : totalMultiplier >= 50 ? 54 : totalMultiplier >= 25 ? 52 : totalMultiplier >= 10 ? 50 : totalMultiplier >= 5 ? 48 : 38; var dataMsgText = new Text2(msgText, { size: msgSize, fill: msgColor }); dataMsgText.anchor.set(0, 0.5); // Limit message width to avoid overflow (max 700px), and reposition if needed var maxMsgWidth = 700; if (dataMsgText.width > maxMsgWidth) { dataMsgText.scaleX = maxMsgWidth / dataMsgText.width; } dataMsgText.x = winBarText.x + 120; if (dataMsgText.x + dataMsgText.width * dataMsgText.scaleX > 2048 - 40) { // If message would overflow right edge, move left dataMsgText.x = 2048 - 40 - dataMsgText.width * dataMsgText.scaleX; if (dataMsgText.x < winBarText.x + 40) dataMsgText.x = winBarText.x + 40; } dataMsgText.y = winBarText.y; game.addChild(dataMsgText); // Remove after 1.2s LK.setTimeout(function () { if (dataMsgText && dataMsgText.destroy) dataMsgText.destroy(); }, 1200); } currentWin += winScore; updateScore(); updateScoreBar(); // 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 { // Add currentWin to total score after all breaks score += currentWin; currentWin = 0; updateScore(); updateScoreBar(); 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, and persist score to storage 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 }); } }); } // --- Save score to persistent storage --- storage.lastScore = score; // Save to leaderboard if high enough if (!storage.leaderboard) storage.leaderboard = []; // Only save if score is positive and not already in leaderboard if (score > 0) { // Get leaderboard array (single depth, literal values only) var leaderboard = storage.leaderboard || []; // Add score if not present, or if higher than existing var found = false; for (var i = 0; i < leaderboard.length; i++) { if (leaderboard[i] === score) { found = true; break; } } if (!found) { leaderboard.push(score); // Sort descending, keep top 10 leaderboard.sort(function (a, b) { return b - a; }); if (leaderboard.length > 10) leaderboard = leaderboard.slice(0, 10); storage.leaderboard = leaderboard; } } } // --- Leaderboard UI --- // Show leaderboard button (bottom right, outside grid) // Add black border behind leaderboardBtn var leaderboardBtnBorder = LK.getAsset('score_bar_bg', { width: 132, height: 132, color: 0x000000, shape: 'ellipse', anchorX: 1, anchorY: 1, x: 2048 - 40, y: 2732 - 40 }); game.addChild(leaderboardBtnBorder); var leaderboardBtn = LK.getAsset('score_bar_bg', { width: 120, height: 120, color: 0x2196f3, shape: 'ellipse', anchorX: 1, anchorY: 1, x: 2048 - 40, y: 2732 - 40 }); game.addChild(leaderboardBtn); var leaderboardIcon = new Text2('π', { size: 80, fill: 0xffffff }); leaderboardIcon.anchor.set(0.5, 0.5); leaderboardIcon.x = leaderboardBtn.x - 60; leaderboardIcon.y = leaderboardBtn.y - 60; game.addChild(leaderboardIcon); leaderboardBtn.down = function (x, y, obj) { // Remove any existing leaderboard window if (game._leaderboardWindow && game._leaderboardWindow.length) { for (var i = 0; i < game._leaderboardWindow.length; i++) { if (game._leaderboardWindow[i] && game._leaderboardWindow[i].destroy) game._leaderboardWindow[i].destroy(); } game._leaderboardWindow = []; } // Leaderboard window background // Use the same size and position as the 5x5 grid background (bgSquare) var winW = bgSquareWidth; var winH = bgSquareHeight; var winX = bgSquare.x - bgSquareWidth / 2; var winY = bgSquare.y - bgSquareHeight / 2; var winBg = LK.getAsset('score_bar_bg', { width: winW, height: winH, color: 0x181818, shape: 'box', anchorX: 0, anchorY: 0, x: winX, y: winY }); winBg.alpha = 0.97; // Title var titleText = new Text2("Leaderboard", { size: 90, fill: 0xffeb3b }); titleText.anchor.set(0.5, 0); titleText.x = winX + winW / 2; titleText.y = winY + 32; // Close button var closeBtn = LK.getAsset('score_bar_bg', { width: 80, height: 80, color: 0xd83318, shape: 'ellipse', anchorX: 0.5, anchorY: 0.5, x: winX + winW - 60, y: winY + 60 }); var closeTxt = new Text2('Γ', { size: 60, fill: 0xffffff }); closeTxt.anchor.set(0.5, 0.5); closeTxt.x = closeBtn.x; closeTxt.y = closeBtn.y; closeBtn.down = function () { if (game._leaderboardWindow && game._leaderboardWindow.length) { for (var i = 0; i < game._leaderboardWindow.length; i++) { if (game._leaderboardWindow[i] && game._leaderboardWindow[i].destroy) game._leaderboardWindow[i].destroy(); } game._leaderboardWindow = []; } }; // Leaderboard entries var leaderboard = storage.leaderboard || []; var entryNodes = []; for (var i = 0; i < leaderboard.length; i++) { var entryText = new Text2(i + 1 + ". " + leaderboard[i], { size: 70, fill: i === 0 ? 0xffeb3b : 0xffffff }); entryText.anchor.set(0.5, 0); entryText.x = winX + winW / 2; entryText.y = winY + 140 + i * 90; entryNodes.push(entryText); } // If no entries, show message if (leaderboard.length === 0) { var noEntryText = new Text2("No scores yet. Play to get on the board!", { size: 60, fill: 0xffffff }); noEntryText.anchor.set(0.5, 0.5); noEntryText.x = winX + winW / 2; noEntryText.y = winY + winH / 2; entryNodes.push(noEntryText); } // Add to LK.gui.center for overlay LK.gui.center.addChild(winBg); LK.gui.center.addChild(titleText); LK.gui.center.addChild(closeBtn); LK.gui.center.addChild(closeTxt); for (var i = 0; i < entryNodes.length; i++) { LK.gui.center.addChild(entryNodes[i]); } // Track for removal var leaderboardWindowNodes = [winBg, titleText, closeBtn, closeTxt].concat(entryNodes); game._leaderboardWindow = leaderboardWindowNodes; }; // Check if any matches are possible (i.e., if any genus has 6+ blocks) function hasMatches() { var matches = findMatches(); return matches.length > 0; } // Track number of spins played using persistent storage var playedSpins = storage.playedSpins || 0; // Handle Spin button press function onSpin() { if (isSpinning) return; if (score < spinAmount) { // Not enough score to spin, show game over LK.effects.flashScreen(0x000000, 600); LK.showGameOver(); return; } // Increment playedSpins and store in persistent storage playedSpins++; storage.playedSpins = playedSpins; // Only deduct score after a successful spin (after grid is filled and not interrupted) 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(); // Deduct spinAmount only after grid is filled and spin is valid score -= spinAmount; currentWin = 0; updateScore(); updateScoreBar(); // 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; doSpin(); // immediate, no timeout } else { doSpin(); // immediate, no timeout } } // --- UI Setup --- // --- Spin Amount UI --- // State for spin amount var spinAmount = 500; var spinAmountMin = 200; var spinAmountMax = 4000; var spinAmountStep = 50; // --- Adjoining - spin amount + buttons --- // Layout: [minus][spinAmount][plus] horizontally centered, all touching // Place below the total score bar, but above the spin button // The total score bar is at scoreBarY, which is just below the grid background // We'll place the buttons just below scoreBarY, but above the spin button // Place minus, spin amount, and plus buttons horizontally below the 5x5 grid, outside its bottom side, centered var btnWidth = 160; var btnHeight = 120; var btnGap = 32; // horizontal gap between buttons // Compute the bottom edge of the 5x5 grid background var btnStartY = bgSquare.y + bgSquareHeight / 2 + 80; // 80px below the grid background // Center the button group horizontally with the grid var btnGroupWidth = btnWidth * 3 + btnGap * 2; var btnStartX = bgSquare.x - btnGroupWidth / 2 + btnWidth / 2; // Minus button (red background) var minusBtn = LK.getAsset('minus_btn_red', { width: btnWidth, height: btnHeight, anchorX: 0.5, anchorY: 0.5, x: btnStartX, y: btnStartY }); game.addChild(minusBtn); var minusText = new Text2('-', { size: 90, fill: 0xffffff }); minusText.anchor.set(0.5, 0.5); minusText.x = minusBtn.x; minusText.y = minusBtn.y; game.addChild(minusText); // Spin amount button (white background) var spinAmountBtn = LK.getAsset('spin_amount_btn_white', { width: btnWidth, height: btnHeight, anchorX: 0.5, anchorY: 0.5, x: btnStartX + btnWidth + btnGap, y: btnStartY }); game.addChild(spinAmountBtn); var spinAmountText = new Text2(spinAmount + '', { size: 60, fill: 0x222222 }); spinAmountText.anchor.set(0.5, 0.5); spinAmountText.x = spinAmountBtn.x; spinAmountText.y = spinAmountBtn.y; game.addChild(spinAmountText); // --- Triangle bar as background for total score --- // Make the triangle bar much bigger to cover below minus and plus amount bar var triangleWidth = btnWidth * 3 + btnGap * 2 + 60; // wider than all three buttons plus some margin var triangleHeight = 120; // much taller // Place triangle bar as the background for the total score area // We'll place the triangle bar at the same y as the total score text and label, and add the text/label as children of the triangle bar // "Total Score" label (below the score text, centered in triangle) var scoreLabel = new Text2('Total Score', { size: 36, fill: 0xffffff }); scoreLabel.anchor.set(0.5, 0); // Place total score text inside the triangle bar below the amount bar var scoreBarText = new Text2('0', { size: 64, fill: 0xffffff, font: "Impact, 'Arial Black', Tahoma" }); scoreBarText.anchor.set(0.5, 0.5); // Now that scoreLabel is defined, set triangleY, then update scoreBarText.y and scoreLabel.y accordingly var triangleY = spinAmountBtn.y + btnHeight / 2 + 78; // Create the triangle bar as a container to hold the background and the texts var triangleBar = new Container(); triangleBar.x = spinAmountBtn.x; triangleBar.y = triangleY; // Triangle background var triangle = LK.getAsset('score_bar_total_bg', { width: triangleWidth, height: triangleHeight, color: 0x2196f3, shape: 'box', anchorX: 0.5, anchorY: 0 }); triangle.scaleX = 1.1; triangle.scaleY = 0.7; triangle.rotation = Math.PI; // Point down // Mask the left and right corners to make it look more like a triangle var triangleMaskL = LK.getAsset('spin_amount_btn_white', { width: triangleWidth / 2, height: triangleHeight, color: 0xffffff, shape: 'box', anchorX: 1, anchorY: 0, x: -triangleWidth / 2 + 18, y: 0 }); triangleMaskL.alpha = 0; var triangleMaskR = LK.getAsset('spin_amount_btn_white', { width: triangleWidth / 2, height: triangleHeight, color: 0xffffff, shape: 'box', anchorX: 0, anchorY: 0, x: triangleWidth / 2 - 18, y: 0 }); triangleMaskR.alpha = 0; // Add triangle background and masks to the container triangleBar.addChild(triangle); triangleBar.addChild(triangleMaskL); triangleBar.addChild(triangleMaskR); // Center score text and label inside the triangle bar scoreBarText.x = 0; scoreBarText.y = triangle.height / 2; scoreLabel.x = 0; scoreLabel.y = scoreBarText.y + scoreBarText.height / 2 + 4; // Add text and label to the container triangleBar.addChild(scoreBarText); triangleBar.addChild(scoreLabel); // Add the triangleBar container to the game game.addChild(triangleBar); // (scoreTxt is now handled by scoreBarText above) scoreTxt = scoreBarText; // Plus button (green background) var plusBtn = LK.getAsset('plus_btn_green', { width: btnWidth, height: btnHeight, anchorX: 0.5, anchorY: 0.5, x: btnStartX + (btnWidth + btnGap) * 2, y: btnStartY }); game.addChild(plusBtn); var plusText = new Text2('+', { size: 90, fill: 0xffffff }); plusText.anchor.set(0.5, 0.5); plusText.x = plusBtn.x; plusText.y = plusBtn.y; game.addChild(plusText); // Update spin amount text helper function updateSpinAmountText() { if (spinAmountText) { spinAmountText.setText(spinAmount + ''); // Optionally animate for feedback tween(spinAmountText, { scaleX: 1.15, scaleY: 1.15 }, { duration: 60, easing: tween.cubicOut, onFinish: function onFinish() { tween(spinAmountText, { scaleX: 1, scaleY: 1 }, { duration: 60, easing: tween.cubicIn }); } }); } } // - Button logic minusBtn.down = function (x, y, obj) { if (spinAmount > spinAmountMin) { spinAmount -= spinAmountStep; if (spinAmount < spinAmountMin) spinAmount = spinAmountMin; updateSpinAmountText(); // Animate feedback tween(minusBtn, { scaleX: 0.92, scaleY: 0.92 }, { duration: 60, easing: tween.cubicIn, onFinish: function onFinish() { tween(minusBtn, { scaleX: 1, scaleY: 1 }, { duration: 80, easing: tween.cubicOut }); } }); } }; // + Button logic plusBtn.down = function (x, y, obj) { if (spinAmount < spinAmountMax) { spinAmount += spinAmountStep; if (spinAmount > spinAmountMax) spinAmount = spinAmountMax; updateSpinAmountText(); // Animate feedback tween(plusBtn, { scaleX: 0.92, scaleY: 0.92 }, { duration: 60, easing: tween.cubicIn, onFinish: function onFinish() { tween(plusBtn, { scaleX: 1, scaleY: 1 }, { duration: 80, easing: tween.cubicOut }); } }); } }; // Spin Amount Button logic (optional: could cycle through preset values, but here does nothing) spinAmountBtn.down = function (x, y, obj) { // Animate feedback tween(spinAmountBtn, { scaleX: 0.92, scaleY: 0.92 }, { duration: 60, easing: tween.cubicIn, onFinish: function onFinish() { tween(spinAmountBtn, { scaleX: 1, scaleY: 1 }, { duration: 80, easing: tween.cubicOut }); } }); }; // --- Spin Button (circular, below the grid and spin amount UI) --- var spinBtnRadius = 140; // Add black border behind spinBtn var spinBtnBorder = LK.getAsset('score_bar_bg', { width: spinBtnRadius * 2 + 16, height: spinBtnRadius * 2 + 16, color: 0x000000, shape: 'ellipse', anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: gridStartY + gridTotalSize + spinBtnRadius + 260 }); game.addChild(spinBtnBorder); 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 + 260 // moved below the grid and spin amount UI }); game.addChild(spinBtn); // --- 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 background spin animation }; // Play DonerG main theme music while playing LK.playMusic('DonerG'); // --- Game Initialization --- function initializeGameGridAndScore() { // 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 5000 score, do not fill grid or break until spin is pressed score = 5000; updateScore(); // Do not fillGridRandom or breakAndRefill here; wait for spin button } initializeGameGridAndScore(); // --- Game Update Loop (not used, but required for LK) --- game.update = function () { // No per-frame logic needed };
===================================================================
--- original.js
+++ change.js
@@ -79,8 +79,9 @@
/****
* Game Code
****/
+// blue total score bg
// (Moved after bgSquare is defined to avoid undefined error)
// --- x: @ardabuggy text outside right down 5x5 grid ---
// --- Game Initialization ---
var donerTitleY = 120;
@@ -1322,12 +1323,12 @@
var triangleBar = new Container();
triangleBar.x = spinAmountBtn.x;
triangleBar.y = triangleY;
// Triangle background
-var triangle = LK.getAsset('score_bar_bg', {
+var triangle = LK.getAsset('score_bar_total_bg', {
width: triangleWidth,
height: triangleHeight,
- color: 0x30a262,
+ color: 0x2196f3,
shape: 'box',
anchorX: 0.5,
anchorY: 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