User prompt
perfect but games name is "Potato Blocks"
User prompt
add a starting / intro menu
User prompt
remove music and effects sounds also remove them from settings add other settings make text bigger
User prompt
Please fix the bug: 'TypeError: tween.to is not a function' in or related to this line: 'tween.to(self, {' Line Number: 370 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
add a menu and settings, at the bottom it writes "Created by Mert Özzaman"
Remix started
Copy Block Puzzle
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Block = Container.expand(function (board) { var self = Container.call(this); var hsvToRgb = function hsvToRgb(h, s, v) { var r, g, b; var i = Math.floor(h * 6); var f = h * 6 - i; var p = v * (1 - s); var q = v * (1 - f * s); var t = v * (1 - (1 - f) * s); switch (i % 6) { case 0: r = v, g = t, b = p; break; case 1: r = q, g = v, b = p; break; case 2: r = p, g = v, b = t; break; case 3: r = p, g = q, b = v; break; case 4: r = t, g = p, b = v; break; case 5: r = v, g = p, b = q; break; } return (Math.round(r * 255) << 16) + (Math.round(g * 255) << 8) + Math.round(b * 255); }; var ShapeTypes = { SINGLE: [[1]], TRI: [[1, 1, 1]], QUAD: [[1, 1, 1, 1]], LSHAPE: [[1, 0, 0], [1, 0, 0], [1, 1, 1]], BLOCK: [[1, 1], [1, 1]], SMALLLSHAPE: [[1, 0], [1, 1]] }; var shapes = Object.values(ShapeTypes); var offset = Math.floor(Math.random() * shapes.length); self.shape = shapes[offset]; var hue = offset % shapes.length / shapes.length; self.color = hsvToRgb(hue, 0.6, 1); self.rotateShapeRandomly = function () { var rotations = Math.floor(Math.random() * 4); for (var r = 0; r < rotations; r++) { self.shape = self.shape[0].map(function (val, index) { return self.shape.map(function (row) { return row[index]; }).reverse(); }); } }; self.rotateShapeRandomly(); self.blocks = []; var background = self.attachAsset('background', { anchorX: 0.5, anchorY: 0.5 }); background.alpha = 0; var blockSize = 160; background.width = 4 * blockSize; background.height = 4 * blockSize; self.addChild(background); self.offsetX = 0; self.offsetY = 0; var blockOffsetX = (background.width / 2 - self.shape[0].length * blockSize) / 2 - blockSize / 2; var blockOffsetY = (background.height / 2 - self.shape.length * blockSize) / 2 - blockSize / 2; for (var i = 0; i < self.shape.length; i++) { for (var j = 0; j < self.shape[i].length; j++) { if (self.shape[i][j] === 1) { var block = self.attachAsset('block', { anchorX: 0.5, anchorY: 0.5 }); block.tint = self.color; block.width = blockSize; block.height = blockSize; block.x = j * blockSize + blockOffsetX; block.y = i * blockSize + blockOffsetY; self.blocks.push(block); self.addChild(block); } } } self.startX = 0; self.startY = 0; self.moveTowardsHomePosition = function () { var dx = self.startX - self.x; var dy = self.startY - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 1) { self.x += dx * 0.3; self.y += dy * 0.3; } else { self.x = self.startX; self.y = self.startY; } }; var currentX = 0; var currentY = 0; self.moveToDragTarget = function () { var ox = -this.targetX; var oy = (LK.is.mobile ? 400 : 0) - this.targetY; this.targetX += ox / 5; this.targetY += oy / 5; this.x = currentX - this.targetX; this.y = currentY - this.targetY; }; self._move_migrated = function (x, y) { currentX = x; currentY = y; self.x = x - this.targetX; self.y = y - this.targetY; }; self.setStartPosition = function (x, y) { self.startX = x; self.startY = y; }; self.getOverlappingCells = function () { var cells = []; var boardPos = { x: -board.x + self.x + 160 * 4 + blockOffsetX + 160, y: -board.y + self.y + 160 * 4 + blockOffsetY + 160 }; var startX = Math.floor(boardPos.x / 160); var startY = Math.floor(boardPos.y / 160); for (var i = 0; i < self.shape.length; i++) { for (var j = 0; j < self.shape[i].length; j++) { if (self.shape[i][j] === 1) { var cell = board.grid && board.grid[startY + i] && board.grid[startY + i][startX + j]; if (cell && !cell.filled) { cells.push(cell); } else { return null; } } } } return cells; }; self.showOverlap = function () { var cells = self.getOverlappingCells(); if (cells) { for (var a = 0; a < cells.length; a++) { var cell = cells[a]; cell.setTint(self.color); } } }; self.rotateShapeRandomly = function () { var rotations = Math.floor(Math.random() * 4); for (var r = 0; r < rotations; r++) { self.shape = self.shape[0].map(function (val, index) { return self.shape.map(function (row) { return row[index]; }).reverse(); }); } }; }); var Board = Container.expand(function () { var self = Container.call(this); self.particles = []; Board.prototype.spawnParticles = function (x, y, tint) { for (var i = 0; i < 10; i++) { var particle = new Particle(tint); particle.x = x; particle.y = y; this.particles.push(particle); this.addChild(particle); } }; var background = self.attachAsset('background', { anchorX: 0.5, anchorY: 0.5 }); background.y = -20; background.alpha = .4; background.blendMode = 1; self.grid = new Array(10).fill(null).map(function () { return new Array(10).fill(null); }); var size = 158; var totalWidth = 10 * size; var totalHeight = 10 * size; for (var i = 0; i < 10; i++) { for (var j = 0; j < 10; j++) { var cell = new Cell(); cell.x = i * size - totalWidth / 2 + size / 2; cell.y = j * size - totalHeight / 2 + size / 2; self.grid[j][i] = cell; self.addChild(cell); } } self.removeTint = function () { for (var i = 0; i < 10; i++) { for (var j = 0; j < 10; j++) { if (!self.grid[i][j].filled) { self.grid[i][j].setTint(0xffffff); } } } }; self.checkLines = function () { var rowsRemoved = 0; for (var i = 0; i < 10; i++) { var rowFilled = true; var colFilled = true; for (var j = 0; j < 10; j++) { if (!self.grid[i][j].filled) { rowFilled = false; } if (!self.grid[j][i].filled) { colFilled = false; } } if (rowFilled || colFilled) { rowsRemoved += (rowFilled ? 1 : 0) + (colFilled ? 1 : 0); for (var j = 0; j < 10; j++) { if (rowFilled) { self.grid[i][j].setFill(false); self.spawnParticles(self.grid[i][j].x, self.grid[i][j].y, self.grid[i][j].getTint()); } if (colFilled) { self.grid[j][i].setFill(false); self.spawnParticles(self.grid[j][i].x, self.grid[j][i].y, self.grid[j][i].getTint()); } } } } return rowsRemoved; }; self.tick = function () { for (var i = self.particles.length - 1; i >= 0; i--) { var particle = self.particles[i]; if (particle) { particle.tick(); if (particle.alpha <= 0) { self.particles.splice(i, 1); } } } }; self.placeBlock = function () {}; }); var Cell = Container.expand(function () { var self = Container.call(this); self.filled = false; var empty = self.attachAsset('cell', { anchorX: 0.5, anchorY: 0.5 }); empty.alpha = .8; var filled = self.attachAsset('block', { anchorX: 0.5, anchorY: 0.5 }); empty.y = 2; self.setFill = function (isFilled) { self.filled = isFilled; empty.visible = !self.filled; filled.visible = self.filled; }; self.getTint = function () { return filled.tint; }; self.setTint = function (tint) { empty.tint = filled.tint = tint; }; self.setFill(false); }); var IntroMenu = Container.expand(function () { var self = Container.call(this); // Background for intro menu var menuBackground = self.attachAsset('background', { anchorX: 0.5, anchorY: 0.5 }); menuBackground.width = 1600; menuBackground.height = 2200; menuBackground.alpha = 0.9; menuBackground.tint = 0x222222; // Game title var title = new Text2('POTATO BLOCKS', { size: 140, fill: 0xFFFFFF, font: 'Impact', dropShadow: true, dropShadowColor: '#2a636e' }); title.anchor.set(0.5, 0); title.y = -700; self.addChild(title); // Subtitle var subtitle = new Text2('Arrange potato blocks to clear lines', { size: 60, fill: 0xCCCCCC, font: 'Arial', dropShadow: true, dropShadowColor: '#000000' }); subtitle.anchor.set(0.5, 0); subtitle.y = -500; self.addChild(subtitle); // Start game button var startButton = new Container(); var startButtonBg = startButton.attachAsset('background', { anchorX: 0.5, anchorY: 0.5 }); startButtonBg.width = 600; startButtonBg.height = 160; startButtonBg.tint = 0x4CAF50; var startText = new Text2('START GAME', { size: 100, fill: 0xFFFFFF, font: 'Impact' }); startText.anchor.set(0.5, 0.5); startButton.addChild(startText); startButton.y = -200; startButton.interactive = true; startButton.on('down', function () { self.emit('start'); }); self.addChild(startButton); // Settings button var settingsButton = new Container(); var settingsButtonBg = settingsButton.attachAsset('background', { anchorX: 0.5, anchorY: 0.5 }); settingsButtonBg.width = 600; settingsButtonBg.height = 160; settingsButtonBg.tint = 0x2196F3; var settingsText = new Text2('SETTINGS', { size: 100, fill: 0xFFFFFF, font: 'Impact' }); settingsText.anchor.set(0.5, 0.5); settingsButton.addChild(settingsText); settingsButton.y = 0; settingsButton.interactive = true; settingsButton.on('down', function () { self.emit('settings'); }); self.addChild(settingsButton); // Creator text var creatorText = new Text2('Created by Mert Özzaman', { size: 60, fill: 0xFFFFFF, font: 'Arial' }); creatorText.anchor.set(0.5, 0.5); creatorText.y = 700; self.addChild(creatorText); // Block decoration (animated) var decorationBlocks = []; var colors = [0x4CAF50, 0x2196F3, 0xF44336, 0xFFEB3B, 0x9C27B0]; for (var i = 0; i < 8; i++) { var block = self.attachAsset('block', { anchorX: 0.5, anchorY: 0.5 }); block.tint = colors[i % colors.length]; block.width = 120; block.height = 120; block.x = Math.random() * 1400 - 700; block.y = Math.random() * 2000 - 1000; block.rotation = Math.random() * Math.PI * 2; block.alpha = 0.6; block.vx = Math.random() * 2 - 1; block.vy = Math.random() * 2 - 1; block.vr = (Math.random() * 2 - 1) * 0.02; decorationBlocks.push(block); } self.update = function () { // Animate decoration blocks for (var i = 0; i < decorationBlocks.length; i++) { var block = decorationBlocks[i]; block.x += block.vx; block.y += block.vy; block.rotation += block.vr; // Bounce off edges if (Math.abs(block.x) > 700) { block.vx *= -1; } if (Math.abs(block.y) > 900) { block.vy *= -1; } } }; // Animation methods self.show = function () { self.visible = true; self.alpha = 0; tween(self, { alpha: 1 }, { duration: 500 }); // Animate title coming in from top title.y = -900; tween(title, { y: -700 }, { duration: 700, ease: 'easeOutBack' }); }; self.hide = function () { tween(self, { alpha: 0 }, { duration: 500, onFinish: function onFinish() { self.visible = false; } }); }; return self; }); var Menu = Container.expand(function () { var self = Container.call(this); // Background for menu var menuBackground = self.attachAsset('background', { anchorX: 0.5, anchorY: 0.5 }); menuBackground.width = 1200; menuBackground.height = 1600; menuBackground.alpha = 0.9; menuBackground.tint = 0x333333; // Title var title = new Text2('Potato Blocks', { size: 100, fill: 0xFFFFFF, font: 'Impact', dropShadow: true, dropShadowColor: '#2a636e' }); title.anchor.set(0.5, 0); title.y = -600; self.addChild(title); // Play button var playButton = new Container(); var playButtonBg = playButton.attachAsset('background', { anchorX: 0.5, anchorY: 0.5 }); playButtonBg.width = 500; playButtonBg.height = 120; playButtonBg.tint = 0x4CAF50; var playText = new Text2('PLAY', { size: 100, fill: 0xFFFFFF, font: 'Impact' }); playText.anchor.set(0.5, 0.5); playButton.addChild(playText); playButton.y = -300; playButton.interactive = true; playButton.on('down', function () { self.emit('play'); }); self.addChild(playButton); // Settings button var settingsButton = new Container(); var settingsButtonBg = settingsButton.attachAsset('background', { anchorX: 0.5, anchorY: 0.5 }); settingsButtonBg.width = 500; settingsButtonBg.height = 120; settingsButtonBg.tint = 0x2196F3; var settingsText = new Text2('SETTINGS', { size: 100, fill: 0xFFFFFF, font: 'Impact' }); settingsText.anchor.set(0.5, 0.5); settingsButton.addChild(settingsText); settingsButton.y = -150; settingsButton.interactive = true; settingsButton.on('down', function () { self.emit('settings'); }); self.addChild(settingsButton); // Creator text var creatorText = new Text2('Created by Mert Özzaman', { size: 60, fill: 0xFFFFFF, font: 'Arial' }); creatorText.anchor.set(0.5, 0.5); creatorText.y = 700; self.addChild(creatorText); self.show = function () { self.visible = true; self.alpha = 0; tween(self, { alpha: 1 }, { duration: 300 }); }; self.hide = function () { tween(self, { alpha: 0 }, { duration: 300, onFinish: function onFinish() { self.visible = false; } }); }; return self; }); var Particle = Container.expand(function (tint) { var self = Container.call(this); self.tint = tint; var particleGraphics = self.attachAsset('particle', { anchorX: 0.5, anchorY: 0.5 }); particleGraphics.rotation = Math.random() * Math.PI * 2; particleGraphics.tint = self.tint; self.vx = Math.random() * 4 - 2; self.vy = Math.random() * 4 - 2; self.alpha = 1; self.lifetime = 60; self.tick = function () { self.x += self.vx; self.y += self.vy; self.alpha -= 1 / self.lifetime; if (self.alpha <= 0) { self.destroy(); } }; }); var Settings = Container.expand(function () { var self = Container.call(this); // Background for settings var settingsBackground = self.attachAsset('background', { anchorX: 0.5, anchorY: 0.5 }); settingsBackground.width = 1200; settingsBackground.height = 1600; settingsBackground.alpha = 0.9; settingsBackground.tint = 0x333333; // Title var title = new Text2('Settings', { size: 100, fill: 0xFFFFFF, font: 'Impact', dropShadow: true, dropShadowColor: '#2a636e' }); title.anchor.set(0.5, 0); title.y = -600; self.addChild(title); // Theme toggle button var themeButton = new Container(); var themeButtonBg = themeButton.attachAsset('background', { anchorX: 0.5, anchorY: 0.5 }); themeButtonBg.width = 500; themeButtonBg.height = 120; themeButtonBg.tint = 0x4CAF50; var themeText = new Text2('Theme: Light', { size: 80, fill: 0xFFFFFF, font: 'Impact' }); themeText.anchor.set(0.5, 0.5); themeButton.addChild(themeText); // Theme state var lightTheme = true; themeButton.y = -300; themeButton.interactive = true; themeButton.on('down', function () { lightTheme = !lightTheme; themeText.setText('Theme: ' + (lightTheme ? 'Light' : 'Dark')); themeButtonBg.tint = lightTheme ? 0x4CAF50 : 0x673AB7; self.emit('themeChange', lightTheme); }); self.addChild(themeButton); // Difficulty toggle button var difficultyButton = new Container(); var difficultyButtonBg = difficultyButton.attachAsset('background', { anchorX: 0.5, anchorY: 0.5 }); difficultyButtonBg.width = 500; difficultyButtonBg.height = 120; difficultyButtonBg.tint = 0x4CAF50; var difficultyText = new Text2('Difficulty: Easy', { size: 80, fill: 0xFFFFFF, font: 'Impact' }); difficultyText.anchor.set(0.5, 0.5); difficultyButton.addChild(difficultyText); // Difficulty state var difficultyLevel = 0; // 0: Easy, 1: Medium, 2: Hard difficultyButton.y = -150; difficultyButton.interactive = true; difficultyButton.on('down', function () { difficultyLevel = (difficultyLevel + 1) % 3; var difficultyNames = ['Easy', 'Medium', 'Hard']; var difficultyColors = [0x4CAF50, 0xFF9800, 0xF44336]; difficultyText.setText('Difficulty: ' + difficultyNames[difficultyLevel]); difficultyButtonBg.tint = difficultyColors[difficultyLevel]; self.emit('difficultyChange', difficultyLevel); }); self.addChild(difficultyButton); // Animations toggle button var animationsButton = new Container(); var animationsButtonBg = animationsButton.attachAsset('background', { anchorX: 0.5, anchorY: 0.5 }); animationsButtonBg.width = 500; animationsButtonBg.height = 120; animationsButtonBg.tint = 0x4CAF50; var animationsText = new Text2('Animations: ON', { size: 80, fill: 0xFFFFFF, font: 'Impact' }); animationsText.anchor.set(0.5, 0.5); animationsButton.addChild(animationsText); // Animations state var animationsOn = true; animationsButton.y = 0; animationsButton.interactive = true; animationsButton.on('down', function () { animationsOn = !animationsOn; animationsText.setText('Animations: ' + (animationsOn ? 'ON' : 'OFF')); animationsButtonBg.tint = animationsOn ? 0x4CAF50 : 0xF44336; self.emit('animationsChange', animationsOn); }); self.addChild(animationsButton); // Back button var backButton = new Container(); var backButtonBg = backButton.attachAsset('background', { anchorX: 0.5, anchorY: 0.5 }); backButtonBg.width = 500; backButtonBg.height = 120; backButtonBg.tint = 0x9E9E9E; var backText = new Text2('BACK', { size: 80, fill: 0xFFFFFF, font: 'Impact' }); backText.anchor.set(0.5, 0.5); backButton.addChild(backText); backButton.y = 150; backButton.interactive = true; backButton.on('down', function () { self.emit('back'); }); self.addChild(backButton); // Creator text var creatorText = new Text2('Created by Mert Özzaman', { size: 60, fill: 0xFFFFFF, font: 'Arial' }); creatorText.anchor.set(0.5, 0.5); creatorText.y = 700; self.addChild(creatorText); self.show = function () { self.visible = true; self.alpha = 0; tween(self, { alpha: 1 }, { duration: 300 }); }; self.hide = function () { tween(self, { alpha: 0 }, { duration: 300, onFinish: function onFinish() { self.visible = false; } }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Game state tracking var gameState = "intro"; // Can be: intro, playing, paused // Create the game background var gameBackground = game.attachAsset('gameBackground', { anchorX: 0.5, anchorY: 0.5 }); gameBackground.x = 2048 / 2; gameBackground.y = 2732 / 2; // Create intro menu var introMenu = new IntroMenu(); introMenu.x = 2048 / 2; introMenu.y = 2732 / 2; game.addChild(introMenu); introMenu.show(); // Initialize game elements (hidden initially) var tilesBackground = game.attachAsset('tileBackground', { anchorX: 0.5, anchorY: 0.5 }); tilesBackground.y = -20; tilesBackground.alpha = 0; // Start hidden tilesBackground.blendMode = 1; var blocks = []; var dragTarget; var board = game.addChild(new Board()); board.x = 2048 / 2; board.y = 2732 / 2 - 250 + 30; board.alpha = 0; // Start hidden tilesBackground.x = 2048 / 2; tilesBackground.y = 2732 - 300; var targetOffset; // Function to start the actual game function startGame() { gameState = "playing"; // Animate game elements in tween(board, { alpha: 1 }, { duration: 500 }); tween(tilesBackground, { alpha: 0.4 }, { duration: 500 }); // Clear any existing blocks for (var i = 0; i < blocks.length; i++) { if (blocks[i]) { blocks[i].destroy(); } } blocks = []; // Reset score score = 0; scoreTxt.setText("0"); // Create initial blocks game.createBlocks(); } game.createBlock = function (index) { var block = new Block(board); block.x = 2048 / 2 + (index - 1) * (block.width + 30); block.y = 2732 + block.height; block.setStartPosition(block.x, 2732 - block.height / 2 - 30); blocks.push(block); game.addChild(block); block.on('down', function (x, y, obj) { dragTarget = this; var pos = this.toLocal(obj.global); var targetPos = game.toLocal(obj.global); this.targetX = pos.x; this.targetY = pos.y; dragTarget._move_migrated(targetPos.x, targetPos.y); }); }; game.on('move', function (x, y, obj) { if (dragTarget) { board.removeTint(); var pos = game.toLocal(obj.global); dragTarget._move_migrated(pos.x, pos.y); dragTarget.showOverlap(); } }); game.on('up', function (x, y, obj) { if (dragTarget) { var cells = dragTarget.getOverlappingCells(); if (cells) { for (var a = 0; a < cells.length; a++) { cells[a].setFill(true); cells[a].setTint(dragTarget.color); } blocks[blocks.indexOf(dragTarget)] = undefined; dragTarget.destroy(); if (!blocks.some(function (block) { return block; })) { game.createBlocks(); } var pointsToAdd = board.checkLines(); if (pointsToAdd) { score += Math.pow(pointsToAdd, 2) * 10; scoreTxt.setText(score); } } board.removeTint(); dragTarget = undefined; } }); game.createBlocks = function () { for (var i = 0; i < 3; i++) { game.createBlock(i); } }; var score = 0; // Create menu button var menuButton = new Container(); var menuButtonBg = menuButton.attachAsset('background', { anchorX: 0.5, anchorY: 0.5 }); menuButtonBg.width = 100; menuButtonBg.height = 100; menuButtonBg.tint = 0x2196F3; var menuText = new Text2('≡', { size: 80, fill: 0xFFFFFF, font: 'Arial' }); menuText.anchor.set(0.5, 0.5); menuButton.addChild(menuText); menuButton.x = 1920; menuButton.y = 100; menuButton.interactive = true; menuButton.on('down', function () { toggleMenu(); }); game.addChild(menuButton); // Create menu var gameMenu = new Menu(); gameMenu.x = 2048 / 2; gameMenu.y = 2732 / 2; gameMenu.visible = false; game.addChild(gameMenu); // Create settings var gameSettings = new Settings(); gameSettings.x = 2048 / 2; gameSettings.y = 2732 / 2; gameSettings.visible = false; game.addChild(gameSettings); // Add event handlers gameMenu.on('play', function () { gameMenu.hide(); resumeGame(); }); gameMenu.on('settings', function () { gameMenu.hide(); gameSettings.show(); }); // Add intro menu event handlers introMenu.on('start', function () { introMenu.hide(); startGame(); }); introMenu.on('settings', function () { gameSettings.show(); introMenu.hide(); }); gameSettings.on('back', function () { gameSettings.hide(); // Return to the correct menu based on game state if (gameState === "intro") { introMenu.show(); } else { gameMenu.show(); } }); // Add theme change handler gameSettings.on('themeChange', function (isLight) { var backgroundColor = isLight ? 0xffffff : 0x222222; gameBackground.tint = isLight ? 0xffffff : 0x333333; }); // Add difficulty change handler gameSettings.on('difficultyChange', function (level) { // 0: Easy, 1: Medium, 2: Hard // Adjust game difficulty based on level var difficultyFactors = [1, 1.5, 2]; var factor = difficultyFactors[level]; // Apply difficulty effect (for example, make blocks more complex) }); // Add animations change handler gameSettings.on('animationsChange', function (enabled) { // Toggle animations based on enabled state }); // Menu functions var gamePaused = false; function toggleMenu() { if (gameMenu.visible || gameSettings.visible) { if (gameMenu.visible) { gameMenu.hide(); } if (gameSettings.visible) { gameSettings.hide(); } resumeGame(); } else { pauseGame(); gameMenu.show(); } } function pauseGame() { gamePaused = true; } function resumeGame() { gamePaused = false; } // Function to return to intro menu (can be called after game over) function returnToIntroMenu() { gameState = "intro"; introMenu.show(); // Hide game elements board.alpha = 0; tilesBackground.alpha = 0; // Clear blocks for (var i = 0; i < blocks.length; i++) { if (blocks[i]) { blocks[i].destroy(); } } blocks = []; } // Creator text at bottom var creatorText = new Text2('Created by Mert Özzaman', { size: 50, fill: 0xFFFFFF, font: 'Arial', dropShadow: true, dropShadowColor: '#000000' }); creatorText.anchor.set(0.5, 1); creatorText.x = 2048 / 2; creatorText.y = 2732 - 20; game.addChild(creatorText); game.createBlocks(); var scoreTxt = new Text2('0', { size: 200, fill: 0xFFFFFF, font: 'Impact', dropShadow: true, dropShadowColor: '#2a636e' }); scoreTxt.anchor.set(.5, 0); LK.gui.top.addChild(scoreTxt); game.isMovePossible = function () { for (var a = 0; a < blocks.length; a++) { if (blocks[a]) { for (var i = 0; i < 10; i++) { for (var j = 0; j < 10; j++) { if (board.grid[i][j].filled) { continue; } var canPlace = true; for (var k = 0; k < blocks[a].shape.length; k++) { for (var l = 0; l < blocks[a].shape[k].length; l++) { if (blocks[a].shape[k][l] === 1) { if (i + k < 0 || i + k >= 10 || j + l < 0 || j + l >= 10 || board.grid[i + k][j + l].filled) { canPlace = false; break; } } } if (!canPlace) { break; } } if (canPlace) { return true; } } } } } return false; }; var isGameOver = false; LK.on('tick', function () { // Handle different game states if (gameState === "intro") { // Update intro menu animations introMenu.update(); return; } // Skip game updates if paused if (gamePaused) return; // Only run game logic when in playing state if (gameState === "playing") { board.tick(); if (isGameOver || !game.isMovePossible()) { LK.effects.flashScreen(0xffffff, 1000); LK.showGameOver(); } for (var a = blocks.length - 1; a >= 0; a--) { if (blocks[a]) { if (blocks[a] != dragTarget) { blocks[a].moveTowardsHomePosition(); } else { blocks[a].moveToDragTarget(); } } } } });
===================================================================
--- original.js
+++ change.js
@@ -290,9 +290,9 @@
menuBackground.height = 2200;
menuBackground.alpha = 0.9;
menuBackground.tint = 0x222222;
// Game title
- var title = new Text2('BLOCK PUZZLE', {
+ var title = new Text2('POTATO BLOCKS', {
size: 140,
fill: 0xFFFFFF,
font: 'Impact',
dropShadow: true,
@@ -301,9 +301,9 @@
title.anchor.set(0.5, 0);
title.y = -700;
self.addChild(title);
// Subtitle
- var subtitle = new Text2('Arrange blocks to clear lines', {
+ var subtitle = new Text2('Arrange potato blocks to clear lines', {
size: 60,
fill: 0xCCCCCC,
font: 'Arial',
dropShadow: true,
@@ -442,9 +442,9 @@
menuBackground.height = 1600;
menuBackground.alpha = 0.9;
menuBackground.tint = 0x333333;
// Title
- var title = new Text2('Block Puzzle', {
+ var title = new Text2('Potato Blocks', {
size: 100,
fill: 0xFFFFFF,
font: 'Impact',
dropShadow: true,
Background for relaxing puzzle game. Pastel colors, flat shaded, vector art. Flowers. Blocks. Relaxing. Clouds Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
White particle cloud. Cartoon. Bright outline. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a big nose potato block which is really happy . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
potato colour square with round corners, flat shaded, hyper casual game. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.