User prompt
Fix error
User prompt
Fixa så det blir rätt när man spelet, för nu slumpas och försvinner kuber i fel tid
User prompt
When 3 in row, it transforms to new cube in new color that not been before
User prompt
Fix different colors on assets
User prompt
Fix game orginal mekanic system to, Players receive a random colored block - Drag and drop the block onto any empty cell. - When three or more adjacent blocks of the same color connect, they merge into a new color and clear, scoring points. - Merges can trigger chain reactions for bonus points. - The game ends when the grid is full and no moves remain. - Aim for high scores by planning merges and creating cascades.
User prompt
Fixa spel mekaniken som det var i början vid första generingen
User prompt
Fixa spelet så det funkar som det skall, att kuberna förvandlas till 1 ny kub med en helt ny färg som vit eller gul eller annan färg, men ingen färg som varit innan
User prompt
Remove green color cube
User prompt
Fix dark green, transform to one cube, it disappeared in wrong moment now, fix that
User prompt
Fix green cube asset transform like the other cubes in other colors
User prompt
Den gröna förvandlas inte till 1 kub i en ny färg, fixa det
User prompt
Gör färre färger
User prompt
När tre kuber av samma färg är i rad eller bredvid varandra, smälter de samman en ny färg till 1 enda kub
User prompt
När en färg av samma kommer 3 i rad eller 3 bredvid varandra så förvandlas dom 3 till 1 helt ny kub i en annan färg
User prompt
Fixa samma spel mekanik som i början då spelet skapades
User prompt
Fixa så att alla 3 kuber när dom är i rad, förvandlas till 1 kub
User prompt
När kuberna är 3 i rad eller bredvid varandra får dom en helt ny färg och blir 1 kub
User prompt
Ge fler variation på färgerna på kuberna alla skall ha olika färg
User prompt
Gör mer variation med färgerna på kuberna, kommer nästan samma färg hela tiden
User prompt
För många lila, byt färg
User prompt
Use Hd asset on every cube and give different light color to every cube
User prompt
Ge flera olika färger
User prompt
Fix error
User prompt
Ge varje kub, gul, röd, blå, rosa, grön, ljus blå, turkos, vit, svart, och orange färg, varje kub skall ha var sin färg
User prompt
Det finns 2 bruna kuber med samma färg, ge dom olika färger
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // --- Game Over / Reset handled by LK engine --- // --- Block Class --- var Block = Container.expand(function () { var self = Container.call(this); // Default color index (0=red, 1=orange, 2=yellow, 3=green, 4=blue, 5=purple, 6=pink, 7=white, 8=rainbow) self.colorIndex = 0; self.isLocked = false; self.isOnGrid = false; self.gridX = -1; self.gridY = -1; // Attach block asset (default, will be set by setColor) self.blockAsset = self.attachAsset('Hd', { anchorX: 0.5, anchorY: 0.5 }); self.scaleX = 1; self.scaleY = 1; // Set color and locked state self.setColor = function (colorIdx) { self.colorIndex = colorIdx; self.isLocked = false; // No more locked blocks // Remove old asset if exists if (self.blockAsset) { self.removeChild(self.blockAsset); } self.blockAsset = self.attachAsset('Hd', { anchorX: 0.5, anchorY: 0.5 }); self.scaleX = 1; self.scaleY = 1; // Assign each block a unique color: yellow, red, blue, pink, green, light blue, turquoise, white, black, orange var tints = [0xFFF600, // Yellow 0xFF0000, // Red 0x0066FF, // Blue 0xFF69B4, // Pink 0x00FF00, // Green 0x7FDBFF, // Light Blue 0x30FFF6, // Turquoise 0xFFFFFF, // White 0x222222, // Black 0xFFA500 // Orange ]; // Ensure all tints are unique and none are brown/duplicate if (colorIdx >= 0 && colorIdx < tints.length) { self.blockAsset.tint = tints[colorIdx]; // Add a lightful flash effect when color is set LK.effects.flashObject(self.blockAsset, 0xffffff, 220); } else { self.blockAsset.tint = 0xffffff; LK.effects.flashObject(self.blockAsset, 0xffffff, 220); } }; // Animate merge (scale up and back) self.animateMerge = function (_onFinish) { tween(self, { scaleX: 1.25, scaleY: 1.25 }, { duration: 80, easing: tween.easeOut, onFinish: function onFinish() { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 100, easing: tween.easeIn, onFinish: function onFinish() { if (_onFinish) _onFinish(); } }); } }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x222233 }); /**** * Game Code ****/ // Cheerful honey yellow // Cheerful pink // Cheerful yellow // Pure white // Cheerful red // Bright yellow for rainbow // Cheerful purple // Cheerful green // Cheerful blue // More defined, fun, and clear block shapes for each color // visually white, but will be rainbow in logic // Sound for merge // Merged block (final color) // We'll use 5 colors: red, green, blue, yellow, purple // Define block shapes for each color and merged color // --- Game Constants --- // locked block // Removed block_gray asset initialization (no more grey squares) // Face assets in different colors // Flower and honey jar assets var GRID_COLS = 6; var GRID_ROWS = 7; var CELL_SIZE = 260; // px (was 200, now bigger for larger squares) var GRID_OFFSET_X = Math.floor((2048 - GRID_COLS * CELL_SIZE) / 2); var GRID_OFFSET_Y = 350; var COLORS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; // 0=yellow, 1=red, 2=blue, 3=pink, 4=green, 5=light blue, 6=turquoise, 7=white, 8=black, 9=orange var COLOR_NAMES = ['yellow', 'red', 'blue', 'pink', 'green', 'light blue', 'turquoise', 'white', 'black', 'orange']; var MAX_COLOR_INDEX = 9; // 0-9 normal, 9=orange (final, can't merge further) var RAINBOW_COLOR_INDEX = 10; // special rainbow block (if needed) var BLOCK_DROP_Y = 2200; // y position for blocks that fall off // --- Game State --- var grid = []; // 2D array [col][row] of Block or null for (var c = 0; c < GRID_COLS; c++) { grid[c] = []; for (var r = 0; r < GRID_ROWS; r++) { grid[c][r] = null; } } var draggingBlock = null; var dragOffsetX = 0; var dragOffsetY = 0; var nextBlocks = []; // Array of next blocks to place var score = 0; var scoreTxt = null; var isProcessing = false; // Prevent input during merges // --- Undo/Föregående State --- var prevState = null; // Helper: Deep copy grid state (only colorIndex, isLocked, isOnGrid, gridX, gridY) function copyGridState(srcGrid) { var arr = []; for (var c = 0; c < GRID_COLS; c++) { arr[c] = []; for (var r = 0; r < GRID_ROWS; r++) { var b = srcGrid[c][r]; if (b) { arr[c][r] = { colorIndex: b.colorIndex, isLocked: b.isLocked, isOnGrid: b.isOnGrid, gridX: b.gridX, gridY: b.gridY }; } else { arr[c][r] = null; } } } return arr; } // Helper: Deep copy nextBlocks state (only colorIndex) function copyNextBlocksState(srcNextBlocks) { var arr = []; for (var i = 0; i < srcNextBlocks.length; i++) { arr.push({ colorIndex: srcNextBlocks[i].colorIndex }); } return arr; } // Save current state for undo function savePrevState() { prevState = { grid: copyGridState(grid), nextBlocks: copyNextBlocksState(nextBlocks), score: score }; } // Restore previous state (undo) function restorePrevState() { if (!prevState) return; // Remove all blocks from game for (var c = 0; c < GRID_COLS; c++) { for (var r = 0; r < GRID_ROWS; r++) { if (grid[c][r]) { grid[c][r].destroy(); grid[c][r] = null; } } } // Restore grid for (var c = 0; c < GRID_COLS; c++) { for (var r = 0; r < GRID_ROWS; r++) { var bdata = prevState.grid[c][r]; if (bdata) { var b = new Block(); b.setColor(bdata.colorIndex); b.isOnGrid = bdata.isOnGrid; b.gridX = bdata.gridX; b.gridY = bdata.gridY; var pos = getPosForCell(c, r); b.x = pos.x; b.y = pos.y; grid[c][r] = b; game.addChild(b); } else { grid[c][r] = null; } } } // Remove all nextBlocks from game for (var i = 0; i < nextBlocks.length; i++) { if (nextBlocks[i]) nextBlocks[i].destroy(); } nextBlocks = []; // Restore nextBlocks for (var i = 0; i < prevState.nextBlocks.length; i++) { var nb = new Block(); nb.setColor(prevState.nextBlocks[i].colorIndex); nb.x = 2048 / 2 + (nextBlocks.length - 1) * 220; nb.y = 220; nb.scaleX = nb.scaleY = 1; nb.isOnGrid = false; nb.gridX = -1; nb.gridY = -1; game.addChild(nb); nextBlocks.push(nb); } // Reposition nextBlocks for (var i = 0; i < nextBlocks.length; i++) { var bx = 2048 / 2 + (i - 1) * 220; nextBlocks[i].x = bx; nextBlocks[i].y = 220; } // Restore score score = prevState.score; scoreTxt.setText(score); prevState = null; } // Add a button for undo/föregående var undoBtn = new Text2('⟲', { size: 110, fill: "#fff" }); undoBtn.anchor.set(0.5, 0.5); undoBtn.x = 2048 - 120; undoBtn.y = 120; undoBtn.interactive = true; undoBtn.buttonMode = true; undoBtn.down = function () { restorePrevState(); }; LK.gui.top.addChild(undoBtn); // --- GUI Elements --- scoreTxt = new Text2('0', { size: 120, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // --- Draw Background Image --- var background = LK.getAsset('Background', { width: 2048, height: 2732, anchorX: 0, anchorY: 0, x: 0, y: 0, alpha: 1 }); game.addChild(background); // --- Draw Grid Background --- for (var c = 0; c < GRID_COLS; c++) { for (var r = 0; r < GRID_ROWS; r++) { var cell = LK.getAsset('block_white', { anchorX: 0.5, anchorY: 0.5, x: GRID_OFFSET_X + c * CELL_SIZE + CELL_SIZE / 2, y: GRID_OFFSET_Y + r * CELL_SIZE + CELL_SIZE / 2, alpha: 0.08 }); game.addChild(cell); } } // --- Draw Grid Lines --- for (var c = 0; c <= GRID_COLS; c++) { var x = GRID_OFFSET_X + c * CELL_SIZE; var y1 = GRID_OFFSET_Y; var y2 = GRID_OFFSET_Y + GRID_ROWS * CELL_SIZE; // Draw vertical line as a thick, high-contrast rectangle var vline = LK.getAsset('block_black', { width: 14, height: GRID_ROWS * CELL_SIZE, anchorX: 0.5, anchorY: 0, x: x, y: y1, alpha: 0.38 }); game.addChild(vline); } for (var r = 0; r <= GRID_ROWS; r++) { var y = GRID_OFFSET_Y + r * CELL_SIZE; var x1 = GRID_OFFSET_X; var x2 = GRID_OFFSET_X + GRID_COLS * CELL_SIZE; // Draw horizontal line as a thick, high-contrast rectangle var hline = LK.getAsset('block_black', { width: GRID_COLS * CELL_SIZE, height: 14, anchorX: 0, anchorY: 0.5, x: x1, y: y, alpha: 0.38 }); game.addChild(hline); } // --- Helper Functions --- // Get grid cell from x,y (game coordinates) function getGridCellFromPos(x, y) { var gx = Math.floor((x - GRID_OFFSET_X) / CELL_SIZE); var gy = Math.floor((y - GRID_OFFSET_Y) / CELL_SIZE); if (gx < 0 || gx >= GRID_COLS || gy < 0 || gy >= GRID_ROWS) return null; return { col: gx, row: gy }; } // Get position (x,y) for grid cell function getPosForCell(col, row) { return { x: GRID_OFFSET_X + col * CELL_SIZE + CELL_SIZE / 2, y: GRID_OFFSET_Y + row * CELL_SIZE + CELL_SIZE / 2 }; } // Generate a random color index (0-4) function randomColorIndex() { return COLORS[Math.floor(Math.random() * COLORS.length)]; } // Create a new block for the "next" area function createNextBlock(idx) { var block = new Block(); // Assign a unique color for each block in nextBlocks (cycle through rainbow) var uniqueColorIdx = idx; if (nextBlocks.length < COLORS.length) { uniqueColorIdx = COLORS[nextBlocks.length % COLORS.length]; } block.setColor(uniqueColorIdx); block.x = 2048 / 2 + (nextBlocks.length - 1) * 220; block.y = 220; block.scaleX = block.scaleY = 1; block.isOnGrid = false; block.gridX = -1; block.gridY = -1; game.addChild(block); return block; } // Fill nextBlocks to always have 3 blocks function refillNextBlocks() { // Limit: Only allow new blocks if there is at least one empty cell on the grid var emptyCells = 0; for (var c = 0; c < GRID_COLS; c++) { for (var r = 0; r < GRID_ROWS; r++) { if (!grid[c][r]) emptyCells++; } } // Only allow up to 3 next blocks, but never more than empty cells var maxNext = Math.min(3, emptyCells); while (nextBlocks.length < maxNext) { // 5% chance to spawn a rainbow block, otherwise assign a unique color for each block var idx; var rand = Math.random(); if (rand < 0.05) { idx = RAINBOW_COLOR_INDEX; // rainbow } else { // Assign a unique color for each block in nextBlocks (cycle through rainbow) idx = COLORS[nextBlocks.length % COLORS.length]; } var block = createNextBlock(idx); nextBlocks.push(block); } // Remove excess nextBlocks if grid is almost full while (nextBlocks.length > maxNext) { var b = nextBlocks.pop(); if (b) b.destroy(); } // Position them nicely for (var i = 0; i < nextBlocks.length; i++) { var bx = 2048 / 2 + (i - 1) * 220; tween(nextBlocks[i], { x: bx, y: 220 }, { duration: 180, easing: tween.easeInOut }); } } // Remove a block from nextBlocks and shift others function popNextBlock(block) { var idx = nextBlocks.indexOf(block); if (idx >= 0) { nextBlocks.splice(idx, 1); } refillNextBlocks(); } // Place block on grid function placeBlockOnGrid(block, col, row) { block.isOnGrid = true; block.gridX = col; block.gridY = row; grid[col][row] = block; var pos = getPosForCell(col, row); tween(block, { x: pos.x, y: pos.y, scaleX: 1, scaleY: 1 }, { duration: 120, easing: tween.easeOut }); } // Remove block from grid function removeBlockFromGrid(col, row) { var block = grid[col][row]; if (block) { grid[col][row] = null; } } // Find all connected blocks of the same color (DFS) function findConnectedBlocks(col, row, colorIndex, visited) { if (col < 0 || col >= GRID_COLS || row < 0 || row >= GRID_ROWS) return []; if (visited[col + "," + row]) return []; var block = grid[col][row]; if (!block || block.colorIndex !== colorIndex) return []; visited[col + "," + row] = true; var result = [{ col: col, row: row, block: block }]; // 4 directions var dirs = [[1, 0], [-1, 0], [0, 1], [0, -1]]; for (var i = 0; i < dirs.length; i++) { var nc = col + dirs[i][0]; var nr = row + dirs[i][1]; result = result.concat(findConnectedBlocks(nc, nr, colorIndex, visited)); } return result; } // Check if any moves are possible (empty cell exists) function hasMoves() { for (var c = 0; c < GRID_COLS; c++) { for (var r = 0; r < GRID_ROWS; r++) { if (!grid[c][r]) return true; } } return false; } // --- Game Logic --- // Handle block drop onto grid function tryPlaceBlock(block, x, y) { if (isProcessing) return false; var cell = getGridCellFromPos(x, y); if (!cell) return false; var col = cell.col, row = cell.row; if (grid[col][row]) return false; // occupied // No locked blocks, so no need to check if (grid[col][row]) return false; // cell is occupied if (block.colorIndex === RAINBOW_COLOR_INDEX) { // Rainbow block special checks } // Save state for undo before placing savePrevState(); if (block.colorIndex === RAINBOW_COLOR_INDEX) { // Place rainbow block and trigger effect placeBlockOnGrid(block, col, row); block.isOnGrid = true; popNextBlock(block); // Pick a random color present on the grid (not locked, not white, not rainbow) var presentColors = {}; for (var c2 = 0; c2 < GRID_COLS; c2++) { for (var r2 = 0; r2 < GRID_ROWS; r2++) { var b2 = grid[c2][r2]; if (b2 && b2.colorIndex >= 0 && b2.colorIndex <= 4) { presentColors[b2.colorIndex] = true; } } } var colorList = []; for (var k in presentColors) { if (presentColors.hasOwnProperty(k)) colorList.push(parseInt(k)); } if (colorList.length > 0) { var colorToClear = colorList[Math.floor(Math.random() * colorList.length)]; // Animate and remove all blocks of that color for (var c2 = 0; c2 < GRID_COLS; c2++) { for (var r2 = 0; r2 < GRID_ROWS; r2++) { var b2 = grid[c2][r2]; if (b2 && b2.colorIndex === colorToClear) { var tmpBlock = b2; // Store reference before nulling the grid position grid[c2][r2] = null; (function (bref) { tween(bref, { scaleX: 0, scaleY: 0, alpha: 0 }, { duration: 180, easing: tween.easeIn, onFinish: function onFinish() { bref.destroy(); } }); })(tmpBlock); } } } // Add bonus score for rainbow clear score += 200; scoreTxt.setText(score); } // Play a sound for rainbow effect LK.getSound('merge').play(); // After effect, check for game over LK.setTimeout(function () { if (!hasMoves()) { LK.showGameOver(); } }, 220); return true; } // Place block placeBlockOnGrid(block, col, row); popNextBlock(block); // After placement, check for merges processMerges(col, row, function () { // After all merges and cascades, check for game over if (!hasMoves()) { LK.showGameOver(); } }); return true; } // Process merges and cascades starting from (col,row) function processMerges(col, row, onFinish) { if (isProcessing) return; isProcessing = true; var block = grid[col][row]; if (!block || block.isLocked) { isProcessing = false; if (onFinish) onFinish(); return; } var colorIdx = block.colorIndex; if (colorIdx >= MAX_COLOR_INDEX) { isProcessing = false; if (onFinish) onFinish(); return; } // Find all connected blocks of same color var connected = findConnectedBlocks(col, row, colorIdx, {}); if (connected.length >= 3) { // Play happy merge sound only on actual merge and upgrade LK.getSound('merge').play(); // Merge! for (var i = 0; i < connected.length; i++) { var b = connected[i].block; if (b !== block) { // Animate and remove (function (bref) { tween(bref, { scaleX: 0, scaleY: 0, alpha: 0 }, { duration: 120, easing: tween.easeIn, onFinish: function onFinish() { bref.destroy(); } }); })(b); removeBlockFromGrid(b.gridX, b.gridY); } } // Upgrade block color var newColor = colorIdx + 1; if (newColor > MAX_COLOR_INDEX) newColor = MAX_COLOR_INDEX; block.setColor(newColor); block.animateMerge(function () { // After animation, check for further merges (cascade) // We need to check if the upgraded block can merge again LK.setTimeout(function () { // Find new connected blocks after upgrade var newConnected = findConnectedBlocks(col, row, block.colorIndex, {}); if (newConnected.length >= 3) { // Chain reaction: process again processMerges(col, row, onFinish); } else { // No more merges, finish isProcessing = false; if (onFinish) onFinish(); } }, 180); }); // Update score var points = 10 * connected.length * (colorIdx + 1); score += points; scoreTxt.setText(score); } else { isProcessing = false; if (onFinish) onFinish(); } } // --- Input Handling --- // Only allow dragging from nextBlocks game.down = function (x, y, obj) { if (isProcessing) return; for (var i = 0; i < nextBlocks.length; i++) { var block = nextBlocks[i]; // Check if touch is inside block var dx = x - block.x; var dy = y - block.y; if (Math.abs(dx) < 90 && Math.abs(dy) < 90 && !block.isLocked && !block.isOnGrid) { draggingBlock = block; dragOffsetX = dx; dragOffsetY = dy; // Play a sound when picking up a block LK.getSound('merge').play(); // Bring to front game.addChild(block); tween(block, { scaleX: 1.15, scaleY: 1.15 }, { duration: 80, easing: tween.easeOut }); break; } } }; game.move = function (x, y, obj) { if (!draggingBlock) return; draggingBlock.x = x - dragOffsetX; draggingBlock.y = y - dragOffsetY; }; game.up = function (x, y, obj) { if (!draggingBlock) return; // Try to place on grid var placed = tryPlaceBlock(draggingBlock, draggingBlock.x, draggingBlock.y); if (!placed) { // Snap back to next area var idx = nextBlocks.indexOf(draggingBlock); var bx = 2048 / 2 + (idx - 1) * 220; tween(draggingBlock, { x: bx, y: 220, scaleX: 1, scaleY: 1 }, { duration: 120, easing: tween.easeInOut }); } else { // Play a sound when block is placed on the grid LK.getSound('merge').play(); // Block is now on grid, don't need to do anything } draggingBlock = null; }; // --- Game Update Loop --- game.update = function () { // Animate blocks falling off (if any) for (var c = 0; c < GRID_COLS; c++) { for (var r = 0; r < GRID_ROWS; r++) { var block = grid[c][r]; if (block && block.y > BLOCK_DROP_Y) { block.destroy(); grid[c][r] = null; } } } // Occasionally spawn a locked block in a random empty cell (every 10 turns) if (typeof game.turnsSinceLock === "undefined") game.turnsSinceLock = 0; if (typeof game.lastBlocksOnGrid === "undefined") game.lastBlocksOnGrid = 0; var blocksOnGrid = 0; for (var c = 0; c < GRID_COLS; c++) { for (var r = 0; r < GRID_ROWS; r++) { if (grid[c][r]) blocksOnGrid++; } } // Removed logic for spawning gray/locked blocks every 10 turns (no more grey squares) if (blocksOnGrid > game.lastBlocksOnGrid) { game.turnsSinceLock++; game.lastBlocksOnGrid = blocksOnGrid; // No locked block spawn } }; // --- Game Start --- score = 0; scoreTxt.setText(score); refillNextBlocks();
===================================================================
--- original.js
+++ change.js
@@ -36,29 +36,30 @@
anchorY: 0.5
});
self.scaleX = 1;
self.scaleY = 1;
- // Extra lightful, vibrant rainbow colors
- var tints = [0xFF6B81,
- // Light Red
- 0xFFD36B,
- // Light Orange
- 0xFFFF6B,
- // Light Yellow
- 0x6BFFB8,
- // Light Green
- 0x6BCEFF,
+ // Assign each block a unique color: yellow, red, blue, pink, green, light blue, turquoise, white, black, orange
+ var tints = [0xFFF600,
+ // Yellow
+ 0xFF0000,
+ // Red
+ 0x0066FF,
+ // Blue
+ 0xFF69B4,
+ // Pink
+ 0x00FF00,
+ // Green
+ 0x7FDBFF,
// Light Blue
- 0xB36BFF,
- // Light Purple
- 0xFF6BEB,
- // Light Pink
+ 0x30FFF6,
+ // Turquoise
0xFFFFFF,
// White
- 0xFFFFB3 // Rainbow (very light yellow fallback)
+ 0x222222,
+ // Black
+ 0xFFA500 // Orange
];
// Ensure all tints are unique and none are brown/duplicate
- // (No brown color in this array, all are lightful and unique)
if (colorIdx >= 0 && colorIdx < tints.length) {
self.blockAsset.tint = tints[colorIdx];
// Add a lightful flash effect when color is set
LK.effects.flashObject(self.blockAsset, 0xffffff, 220);
@@ -126,12 +127,12 @@
var GRID_ROWS = 7;
var CELL_SIZE = 260; // px (was 200, now bigger for larger squares)
var GRID_OFFSET_X = Math.floor((2048 - GRID_COLS * CELL_SIZE) / 2);
var GRID_OFFSET_Y = 350;
-var COLORS = [0, 1, 2, 3, 4, 5, 6]; // 0=red, 1=orange, 2=yellow, 3=green, 4=blue, 5=purple, 6=pink
-var COLOR_NAMES = ['red', 'orange', 'yellow', 'green', 'blue', 'purple', 'pink', 'white', 'rainbow'];
-var MAX_COLOR_INDEX = 7; // 0-6 normal, 7=white (final, can't merge further)
-var RAINBOW_COLOR_INDEX = 8; // special rainbow block
+var COLORS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; // 0=yellow, 1=red, 2=blue, 3=pink, 4=green, 5=light blue, 6=turquoise, 7=white, 8=black, 9=orange
+var COLOR_NAMES = ['yellow', 'red', 'blue', 'pink', 'green', 'light blue', 'turquoise', 'white', 'black', 'orange'];
+var MAX_COLOR_INDEX = 9; // 0-9 normal, 9=orange (final, can't merge further)
+var RAINBOW_COLOR_INDEX = 10; // special rainbow block (if needed)
var BLOCK_DROP_Y = 2200; // y position for blocks that fall off
// --- Game State ---
var grid = []; // 2D array [col][row] of Block or null
for (var c = 0; c < GRID_COLS; c++) {