User prompt
ana menüdeki dil değiştirdiğimiz butonu kaldır çabuk
User prompt
ana menüdeki how to playin altına bide dil butonu ekliyelim türkçe dil olsun ingilizce olsun ispanyolca olsun arapça olsun ve japonca olsun bu dillerin yazıları yine ing olsun
User prompt
oyun değiştiya nasıl oynanır kısmını da değiştir
User prompt
bence birbirine değen ne kadar top varsa hepsi patlasın (min 3 olması lazım yine) ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
butona tıklandığında şekerler gitmiyor
User prompt
butonu ekranın aynı hizada sağ tarafına alsak
User prompt
bir buton eklesek tekrar ana menüye dönmek içi üç çizgili bir şekilde şeker temalı aynı ana menüdeki gibi ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
yine aynısı oldu
User prompt
oyuna girdiğimde nasıl oynanır butonunun olduğu konuma tıkladığımda iç içe giriyor
User prompt
ana menü ile şekerler iç içe girdi buglandı sorunu düzelt
User prompt
Please fix the bug: 'self.insertChildAt is not a function' in or related to this line: 'self.insertChildAt(titleShadow, self.getChildIndex(titleText));' Line Number: 288
User prompt
ana menüyü biraz daha havalı yap ve geliştir ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
ana menü yap başlatma butonu oyunun adı animasyonlu bir şekilde çıksın ve başlatma butonunun yanına birde nasıl oynanır butonu ekle ve nasıl oynandığını yaz ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
ana menü yap başlatma butonu oyunun adı animasyonlu bir şekilde çıksın ve başlatma butonunun yanına birde nasıl oynanır butonu ekle ve nasıl oynandığını yaz ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
ingilizce yap tüm yazıları ve ana menü yap seviyeyi kaldır hamleyi kaldır sonsuz olsun oyun
User prompt
- **Taş Efekti**: Güçlü kombinasyonlarda ekranın sallanması ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
- **Skor Animasyonu**: Puan artışı sırasında sayıların yükselmesi ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
- **Combo Yazıları**: "Great!", "Awesome!", "Fantastic!" gibi yazılar ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
- **Partikül Efektleri**: Şekerler patlarken renkli partikül saçılması ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
images daki backgroundu arka plan yap
User prompt
arka plandaki o morluğu değiştirsek nasıl olur onun yerine candy crush oyunundaki arka plan olsun
User prompt
neyse sonuncu yaptığımızı kaldır
User prompt
belli bir hamle olsun o hamleye kadar patlatamazsak bitsin
User prompt
bomba ile ilgili herşeyi sil
User prompt
bomba ekle aynı candy crushtaki gibi ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Candy = Container.expand(function (type) { var self = Container.call(this); self.candyType = type || 1; self.gridX = 0; self.gridY = 0; self.isAnimating = false; self.isMatched = false; var candyGraphics = self.attachAsset('candy' + self.candyType, { anchorX: 0.5, anchorY: 0.5 }); self.setGridPosition = function (gridX, gridY) { self.gridX = gridX; self.gridY = gridY; self.x = GRID_START_X + gridX * CELL_SIZE + CELL_SIZE / 2; self.y = GRID_START_Y + gridY * CELL_SIZE + CELL_SIZE / 2; }; self.animateToPosition = function (targetX, targetY, callback) { self.isAnimating = true; tween(self, { x: targetX, y: targetY }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { self.isAnimating = false; if (callback) callback(); } }); }; self.animateFall = function (newGridY, callback) { var targetY = GRID_START_Y + newGridY * CELL_SIZE + CELL_SIZE / 2; self.gridY = newGridY; self.animateToPosition(self.x, targetY, callback); }; self.markForRemoval = function () { self.isMatched = true; tween(self, { alpha: 0, scaleX: 0.1, scaleY: 0.1 }, { duration: 200, easing: tween.easeIn }); }; return self; }); var ComboText = Container.expand(function (message, x, y, color) { var self = Container.call(this); self.x = x; self.y = y; var comboTextDisplay = new Text2(message, { size: 120, fill: color || 0xFFFFFF }); comboTextDisplay.anchor.set(0.5, 0.5); self.addChild(comboTextDisplay); // Initial state self.alpha = 0; self.scaleX = 0.5; self.scaleY = 0.5; // Animate in tween(self, { alpha: 1, scaleX: 1.2, scaleY: 1.2 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { // Hold for a moment LK.setTimeout(function () { // Animate out tween(self, { alpha: 0, scaleX: 1.5, scaleY: 1.5, y: self.y - 100 }, { duration: 300, easing: tween.easeIn, onFinish: function onFinish() { self.destroy(); var index = comboTexts.indexOf(self); if (index > -1) { comboTexts.splice(index, 1); } } }); }, 800); } }); return self; }); var FloatingParticle = Container.expand(function (color, size) { var self = Container.call(this); var particleGraphics = self.attachAsset('particle', { anchorX: 0.5, anchorY: 0.5 }); particleGraphics.tint = color; particleGraphics.scaleX = size; particleGraphics.scaleY = size; self.speed = Math.random() * 2 + 1; self.direction = Math.random() * Math.PI * 2; self.bobOffset = Math.random() * Math.PI * 2; self.bobSpeed = Math.random() * 0.02 + 0.01; self.update = function () { self.x += Math.cos(self.direction) * self.speed; self.y += Math.sin(self.direction) * self.speed + Math.sin(LK.ticks * self.bobSpeed + self.bobOffset) * 0.5; // Wrap around screen if (self.x < -50) self.x = 2098; if (self.x > 2098) self.x = -50; if (self.y < -50) self.y = 2782; if (self.y > 2782) self.y = -50; // Gentle rotation self.rotation += 0.01; }; return self; }); var HowToPlayScreen = Container.expand(function () { var self = Container.call(this); // Background var background = LK.getAsset('gridCell', { anchorX: 0.5, anchorY: 0.5 }); background.x = 2048 / 2; background.y = 2732 / 2; background.scaleX = 12; background.scaleY = 16; background.alpha = 0.9; background.tint = 0x000000; self.addChild(background); // Title var titleText = new Text2('HOW TO PLAY', { size: 120, fill: 0xFF69B4 }); titleText.anchor.set(0.5, 0.5); titleText.x = 2048 / 2; titleText.y = 400; self.addChild(titleText); // Instructions var instructions = ['1. Swap adjacent candies to create matches', '2. Match 3+ connected candies of same type', '3. Candies can connect horizontally & vertically', '4. Larger groups give more points', '5. Create combos for bonus points!']; for (var i = 0; i < instructions.length; i++) { var instructionText = new Text2(instructions[i], { size: 80, fill: 0xFFFFFF }); instructionText.anchor.set(0.5, 0.5); instructionText.x = 2048 / 2; instructionText.y = 700 + i * 150; self.addChild(instructionText); } // Back button var backButton = LK.getAsset('gridCell', { anchorX: 0.5, anchorY: 0.5 }); backButton.x = 2048 / 2; backButton.y = 2200; backButton.scaleX = 1.5; backButton.scaleY = 0.6; backButton.tint = 0xEB4D4B; self.addChild(backButton); var backButtonText = new Text2('BACK', { size: 80, fill: 0xFFFFFF }); backButtonText.anchor.set(0.5, 0.5); backButtonText.x = backButton.x; backButtonText.y = backButton.y; self.addChild(backButtonText); backButton.down = function (x, y, obj) { // Button press animation tween(backButton, { scaleX: 1.3, scaleY: 0.5 }, { duration: 100, onFinish: function onFinish() { tween(backButton, { scaleX: 1.5, scaleY: 0.6 }, { duration: 100 }); } }); // Go back to main menu if (typeof showMainMenu === 'function') { showMainMenu(); } }; return self; }); var MainMenu = Container.expand(function () { var self = Container.call(this); // Create gradient background overlay var gradientOverlay = LK.getAsset('gridCell', { anchorX: 0.5, anchorY: 0.5 }); gradientOverlay.x = 2048 / 2; gradientOverlay.y = 2732 / 2; gradientOverlay.scaleX = 12; gradientOverlay.scaleY = 16; gradientOverlay.alpha = 0.1; gradientOverlay.tint = 0x000000; self.addChild(gradientOverlay); // Add menu decorations var decorations = new MenuDecoration(); self.addChild(decorations); // Create floating background particles var particles = []; for (var i = 0; i < 20; i++) { var colors = [0xFF69B4, 0x4ECDC4, 0xF9CA24, 0xEB4D4B, 0x45B7D1, 0xF0932B]; var color = colors[Math.floor(Math.random() * colors.length)]; var size = Math.random() * 0.8 + 0.3; var particle = new FloatingParticle(color, size); particle.x = Math.random() * 2048; particle.y = Math.random() * 2732; particle.alpha = 0.6; particles.push(particle); self.addChild(particle); } // Game title with enhanced styling var titleText = new Text2('🍭 CANDY MATCH 🍭', { size: 200, fill: 0xFF69B4 }); titleText.anchor.set(0.5, 0.5); titleText.x = 2048 / 2; titleText.y = 500; self.addChild(titleText); // Add title shadow effect var titleShadow = new Text2('🍭 CANDY MATCH 🍭', { size: 200, fill: 0x000000 }); titleShadow.anchor.set(0.5, 0.5); titleShadow.x = 2048 / 2 + 5; titleShadow.y = 505; titleShadow.alpha = 0.3; self.addChildAt(titleShadow, self.getChildIndex(titleText)); // Subtitle var subtitleText = new Text2('✨ Match candies and create sweet combos! ✨', { size: 60, fill: 0xFFFFFF }); subtitleText.anchor.set(0.5, 0.5); subtitleText.x = 2048 / 2; subtitleText.y = 650; subtitleText.alpha = 0.8; self.addChild(subtitleText); // Enhanced start button with glow effect var startButtonGlow = LK.getAsset('gridCell', { anchorX: 0.5, anchorY: 0.5 }); startButtonGlow.x = 2048 / 2; startButtonGlow.y = 1200; startButtonGlow.scaleX = 2.2; startButtonGlow.scaleY = 0.9; startButtonGlow.tint = 0x4ECDC4; startButtonGlow.alpha = 0.3; self.addChild(startButtonGlow); var startButton = LK.getAsset('gridCell', { anchorX: 0.5, anchorY: 0.5 }); startButton.x = 2048 / 2; startButton.y = 1200; startButton.scaleX = 2; startButton.scaleY = 0.8; startButton.tint = 0x4ECDC4; self.addChild(startButton); var startButtonText = new Text2('🚀 START GAME', { size: 90, fill: 0xFFFFFF }); startButtonText.anchor.set(0.5, 0.5); startButtonText.x = startButton.x; startButtonText.y = startButton.y; self.addChild(startButtonText); // Enhanced how to play button with glow effect var howToPlayButtonGlow = LK.getAsset('gridCell', { anchorX: 0.5, anchorY: 0.5 }); howToPlayButtonGlow.x = 2048 / 2; howToPlayButtonGlow.y = 1500; howToPlayButtonGlow.scaleX = 2.2; howToPlayButtonGlow.scaleY = 0.9; howToPlayButtonGlow.tint = 0xF9CA24; howToPlayButtonGlow.alpha = 0.3; self.addChild(howToPlayButtonGlow); var howToPlayButton = LK.getAsset('gridCell', { anchorX: 0.5, anchorY: 0.5 }); howToPlayButton.x = 2048 / 2; howToPlayButton.y = 1500; howToPlayButton.scaleX = 2; howToPlayButton.scaleY = 0.8; howToPlayButton.tint = 0xF9CA24; self.addChild(howToPlayButton); var howToPlayButtonText = new Text2('❓ HOW TO PLAY', { size: 90, fill: 0xFFFFFF }); howToPlayButtonText.anchor.set(0.5, 0.5); howToPlayButtonText.x = howToPlayButton.x; howToPlayButtonText.y = howToPlayButton.y; self.addChild(howToPlayButtonText); // Animate title with rainbow effect self.animateTitle = function () { // Scale animation tween(titleText, { scaleX: 1.15, scaleY: 1.15 }, { duration: 2000, easing: tween.easeInOut, onFinish: function onFinish() { tween(titleText, { scaleX: 1, scaleY: 1 }, { duration: 2000, easing: tween.easeInOut, onFinish: function onFinish() { self.animateTitle(); } }); } }); // Color cycle animation var colors = [0xFF69B4, 0x4ECDC4, 0xF9CA24, 0xEB4D4B, 0x45B7D1]; var currentColorIndex = 0; function cycleColors() { currentColorIndex = (currentColorIndex + 1) % colors.length; tween(titleText, { tint: colors[currentColorIndex] }, { duration: 1500, easing: tween.easeInOut, onFinish: function onFinish() { LK.setTimeout(cycleColors, 500); } }); } cycleColors(); }; // Animate subtitle function animateSubtitle() { tween(subtitleText, { alpha: 1, y: subtitleText.y - 10 }, { duration: 1500, easing: tween.easeInOut, onFinish: function onFinish() { tween(subtitleText, { alpha: 0.6, y: 650 }, { duration: 1500, easing: tween.easeInOut, onFinish: animateSubtitle }); } }); } animateSubtitle(); // Animate button glows function animateGlows() { tween(startButtonGlow, { alpha: 0.6, scaleX: 2.4, scaleY: 1.0 }, { duration: 1200, easing: tween.easeInOut, onFinish: function onFinish() { tween(startButtonGlow, { alpha: 0.3, scaleX: 2.2, scaleY: 0.9 }, { duration: 1200, easing: tween.easeInOut }); } }); tween(howToPlayButtonGlow, { alpha: 0.6, scaleX: 2.4, scaleY: 1.0 }, { duration: 1500, easing: tween.easeInOut, onFinish: function onFinish() { tween(howToPlayButtonGlow, { alpha: 0.3, scaleX: 2.2, scaleY: 0.9 }, { duration: 1500, easing: tween.easeInOut, onFinish: animateGlows }); } }); } animateGlows(); // Update particles self.update = function () { for (var i = 0; i < particles.length; i++) { particles[i].update(); } }; // Enhanced button click handlers startButton.down = function (x, y, obj) { // Button press animation with enhanced effects tween(startButton, { scaleX: 1.7, scaleY: 0.6 }, { duration: 80, onFinish: function onFinish() { tween(startButton, { scaleX: 2.1, scaleY: 0.9 }, { duration: 80, onFinish: function onFinish() { tween(startButton, { scaleX: 2, scaleY: 0.8 }, { duration: 80 }); } }); } }); // Animate button glow on press tween(startButtonGlow, { alpha: 0.8, scaleX: 2.6, scaleY: 1.2 }, { duration: 150, onFinish: function onFinish() { tween(startButtonGlow, { alpha: 0.3, scaleX: 2.2, scaleY: 0.9 }, { duration: 200 }); } }); // Start the game if (typeof startGame === 'function') { startGame(); } }; howToPlayButton.down = function (x, y, obj) { // Button press animation with enhanced effects tween(howToPlayButton, { scaleX: 1.7, scaleY: 0.6 }, { duration: 80, onFinish: function onFinish() { tween(howToPlayButton, { scaleX: 2.1, scaleY: 0.9 }, { duration: 80, onFinish: function onFinish() { tween(howToPlayButton, { scaleX: 2, scaleY: 0.8 }, { duration: 80 }); } }); } }); // Animate button glow on press tween(howToPlayButtonGlow, { alpha: 0.8, scaleX: 2.6, scaleY: 1.2 }, { duration: 150, onFinish: function onFinish() { tween(howToPlayButtonGlow, { alpha: 0.3, scaleX: 2.2, scaleY: 0.9 }, { duration: 200 }); } }); // Show how to play if (typeof showHowToPlay === 'function') { showHowToPlay(); } }; return self; }); var MenuDecoration = Container.expand(function () { var self = Container.call(this); // Create candy decorations around the screen var decorationCount = 12; var _loop = function _loop() { candyType = Math.floor(Math.random() * 6) + 1; decoration = LK.getAsset('candy' + candyType, { anchorX: 0.5, anchorY: 0.5 }); angle = i / decorationCount * Math.PI * 2; radius = 800 + Math.random() * 200; decoration.x = 2048 / 2 + Math.cos(angle) * radius; decoration.y = 2732 / 2 + Math.sin(angle) * radius; decoration.alpha = 0.3; decoration.scaleX = 0.8 + Math.random() * 0.4; decoration.scaleY = decoration.scaleX; self.addChild(decoration); // Animate decorations animDuration = 3000 + Math.random() * 2000; targetScale = decoration.scaleX + 0.2; function animateDecoration(dec) { tween(dec, { rotation: dec.rotation + Math.PI * 2, scaleX: targetScale, scaleY: targetScale }, { duration: animDuration, easing: tween.easeInOut, onFinish: function onFinish() { targetScale = 0.8 + Math.random() * 0.4; animDuration = 3000 + Math.random() * 2000; animateDecoration(dec); } }); } animateDecoration(decoration); }, candyType, decoration, angle, radius, animDuration, targetScale; for (var i = 0; i < decorationCount; i++) { _loop(); } return self; }); var Particle = Container.expand(function (color, startX, startY) { var self = Container.call(this); self.x = startX; self.y = startY; self.velocityX = (Math.random() - 0.5) * 400; self.velocityY = (Math.random() - 0.5) * 400; self.gravity = 300; self.life = 1.0; self.maxLife = 1.0; var particleGraphics = self.attachAsset('particle', { anchorX: 0.5, anchorY: 0.5 }); particleGraphics.tint = color; particleGraphics.scaleX = Math.random() * 0.8 + 0.4; particleGraphics.scaleY = particleGraphics.scaleX; self.update = function () { self.x += self.velocityX * (1 / 60); self.y += self.velocityY * (1 / 60); self.velocityY += self.gravity * (1 / 60); self.life -= 1 / 60 * 2; var alpha = self.life / self.maxLife; self.alpha = alpha; self.scaleX = alpha * particleGraphics.scaleX; self.scaleY = alpha * particleGraphics.scaleY; if (self.life <= 0) { self.destroy(); var index = particles.indexOf(self); if (index > -1) { particles.splice(index, 1); } } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xff69b4 }); /**** * Game Code ****/ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; } function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } var GRID_SIZE = 8; var CELL_SIZE = 200; var GRID_START_X = (2048 - GRID_SIZE * CELL_SIZE) / 2; var GRID_START_Y = 400; var gameGrid = []; var candyTypes = [1, 2, 3, 4, 5, 6]; var selectedCandy = null; var isProcessing = false; var movesLeft = 999999; var score = 0; var animatingCandies = 0; var particles = []; var comboTexts = []; var currentCombo = 0; // Game state variables var gameState = 'menu'; // 'menu', 'game', 'howtoplay' var mainMenu = null; var howToPlayScreen = null; var gameElements = []; // Initialize grid array for (var x = 0; x < GRID_SIZE; x++) { gameGrid[x] = []; for (var y = 0; y < GRID_SIZE; y++) { gameGrid[x][y] = null; } } // Menu control functions function showMainMenu() { gameState = 'menu'; // Clear game grid and destroy candies for (var x = 0; x < GRID_SIZE; x++) { for (var y = 0; y < GRID_SIZE; y++) { if (gameGrid[x][y]) { gameGrid[x][y].destroy(); gameGrid[x][y] = null; } } } // Clear particles for (var i = particles.length - 1; i >= 0; i--) { particles[i].destroy(); } particles = []; // Clear combo texts for (var i = comboTexts.length - 1; i >= 0; i--) { comboTexts[i].destroy(); } comboTexts = []; // Reset game state selectedCandy = null; isProcessing = false; animatingCandies = 0; currentCombo = 0; hideAllScreens(); if (!mainMenu) { mainMenu = new MainMenu(); game.addChild(mainMenu); } else { // Recursively re-enable all menu interactions var _enableMenuInteractions = function enableMenuInteractions(container) { container.interactive = true; if (container.children) { for (var i = 0; i < container.children.length; i++) { var child = container.children[i]; child.interactive = true; if (child.children && child.children.length > 0) { _enableMenuInteractions(child); } } } }; mainMenu.alpha = 1; mainMenu.visible = true; mainMenu.interactive = true; _enableMenuInteractions(mainMenu); } mainMenu.animateTitle(); } function showHowToPlay() { gameState = 'howtoplay'; hideAllScreens(); // Completely hide main menu to prevent interactions if (mainMenu) { // Recursively disable all child interactions var _disableMenuInteractions = function disableMenuInteractions(container) { container.interactive = false; if (container.children) { for (var i = 0; i < container.children.length; i++) { var child = container.children[i]; child.interactive = false; if (child.down) { child.down = null; } if (child.children && child.children.length > 0) { _disableMenuInteractions(child); } } } }; mainMenu.alpha = 0; mainMenu.visible = false; mainMenu.interactive = false; _disableMenuInteractions(mainMenu); } if (!howToPlayScreen) { howToPlayScreen = new HowToPlayScreen(); game.addChild(howToPlayScreen); // Ensure how-to-play screen is on top game.setChildIndex(howToPlayScreen, game.children.length - 1); } else { howToPlayScreen.alpha = 1; howToPlayScreen.visible = true; // Bring to front when showing game.setChildIndex(howToPlayScreen, game.children.length - 1); } } function startGame() { gameState = 'game'; hideAllScreens(); initializeGameElements(); } function hideAllScreens() { if (mainMenu) { mainMenu.alpha = 0; mainMenu.visible = false; } if (howToPlayScreen) { howToPlayScreen.alpha = 0; howToPlayScreen.visible = false; } // Hide game elements (except persistent ones like scoreText and backgroundImage) for (var i = 0; i < gameElements.length; i++) { if (gameElements[i] !== scoreText && gameElements[i] !== backgroundImage) { gameElements[i].alpha = 0; } } // Hide menu button specifically if (menuButton) { menuButton.alpha = 0; } } function initializeGameElements() { // Clear existing game elements first for (var i = gameElements.length - 1; i >= 0; i--) { if (gameElements[i] !== scoreText && gameElements[i] !== backgroundImage) { gameElements[i].destroy(); gameElements.splice(i, 1); } } // Show persistent game elements for (var i = 0; i < gameElements.length; i++) { gameElements[i].alpha = 1; } // Draw grid background for (var x = 0; x < GRID_SIZE; x++) { for (var y = 0; y < GRID_SIZE; y++) { var cell = LK.getAsset('gridCell', { anchorX: 0.5, anchorY: 0.5 }); cell.x = GRID_START_X + x * CELL_SIZE + CELL_SIZE / 2; cell.y = GRID_START_Y + y * CELL_SIZE + CELL_SIZE / 2; cell.alpha = 0.4; cell.tint = 0xffffff; game.addChild(cell); gameElements.push(cell); } } // Create coffee cup below the grid var coffee = LK.getAsset('coffee', { anchorX: 0.5, anchorY: 0.5 }); coffee.x = 2048 / 2; coffee.y = GRID_START_Y + GRID_SIZE * CELL_SIZE + 150; game.addChild(coffee); gameElements.push(coffee); // Coffee click handler coffee.down = function (x, y, obj) { // Play coffee sound LK.getSound('coffee').play(); // Shake animation tween(coffee, { x: coffee.x + 10 }, { duration: 50, onFinish: function onFinish() { tween(coffee, { x: coffee.x - 20 }, { duration: 50, onFinish: function onFinish() { tween(coffee, { x: coffee.x + 10 }, { duration: 50 }); } }); } }); }; // Create and show menu button createMenuButton(); if (menuButton) { menuButton.alpha = 1; } // Reset game state score = 0; currentCombo = 0; selectedCandy = null; isProcessing = false; scoreText.setText('Score: 0'); // Clear existing candies and initialize fresh grid for (var x = 0; x < GRID_SIZE; x++) { for (var y = 0; y < GRID_SIZE; y++) { if (gameGrid[x][y]) { gameGrid[x][y].destroy(); gameGrid[x][y] = null; } } } // Initialize the game grid initializeGrid(); } // UI Elements var scoreText = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); gameElements.push(scoreText); // Create background image var backgroundImage = LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5 }); backgroundImage.x = 2048 / 2; backgroundImage.y = 2732 / 2; backgroundImage.scaleX = 2048 / backgroundImage.width; backgroundImage.scaleY = 2732 / backgroundImage.height; game.addChild(backgroundImage); gameElements.push(backgroundImage); // Grid cells will be created when game starts function getRandomCandyType() { return candyTypes[Math.floor(Math.random() * candyTypes.length)]; } function createCandy(x, y, type) { if (!type) type = getRandomCandyType(); var candy = new Candy(type); candy.setGridPosition(x, y); gameGrid[x][y] = candy; game.addChild(candy); return candy; } function initializeGrid() { for (var x = 0; x < GRID_SIZE; x++) { for (var y = 0; y < GRID_SIZE; y++) { var type; var attempts = 0; do { type = getRandomCandyType(); attempts++; } while (attempts < 10 && wouldCreateMatch(x, y, type)); createCandy(x, y, type); } } } function wouldCreateMatch(x, y, type) { var horizontalCount = 1; var verticalCount = 1; // Check horizontal for (var i = x - 1; i >= 0 && gameGrid[i][y] && gameGrid[i][y].candyType === type; i--) { horizontalCount++; } for (var i = x + 1; i < GRID_SIZE && gameGrid[i][y] && gameGrid[i][y].candyType === type; i++) { horizontalCount++; } // Check vertical for (var i = y - 1; i >= 0 && gameGrid[x][i] && gameGrid[x][i].candyType === type; i--) { verticalCount++; } for (var i = y + 1; i < GRID_SIZE && gameGrid[x][i] && gameGrid[x][i].candyType === type; i++) { verticalCount++; } return horizontalCount >= 3 || verticalCount >= 3; } function getCandyAt(worldX, worldY) { var gridX = Math.floor((worldX - GRID_START_X) / CELL_SIZE); var gridY = Math.floor((worldY - GRID_START_Y) / CELL_SIZE); if (gridX >= 0 && gridX < GRID_SIZE && gridY >= 0 && gridY < GRID_SIZE) { return gameGrid[gridX][gridY]; } return null; } function areAdjacent(candy1, candy2) { var dx = Math.abs(candy1.gridX - candy2.gridX); var dy = Math.abs(candy1.gridY - candy2.gridY); return dx === 1 && dy === 0 || dx === 0 && dy === 1; } function swapCandies(candy1, candy2) { var tempX = candy1.gridX; var tempY = candy1.gridY; var tempPosX = candy1.x; var tempPosY = candy1.y; gameGrid[candy1.gridX][candy1.gridY] = candy2; gameGrid[candy2.gridX][candy2.gridY] = candy1; candy1.gridX = candy2.gridX; candy1.gridY = candy2.gridY; candy2.gridX = tempX; candy2.gridY = tempY; animatingCandies += 2; // Play boing sound when candies are swapped LK.getSound('boing').play(); candy1.animateToPosition(candy2.x, candy2.y, function () { animatingCandies--; }); candy2.animateToPosition(tempPosX, tempPosY, function () { animatingCandies--; }); } function findMatches() { var matches = []; var visited = []; // Initialize visited array for (var x = 0; x < GRID_SIZE; x++) { visited[x] = []; for (var y = 0; y < GRID_SIZE; y++) { visited[x][y] = false; } } // Flood fill function to find all connected candies of same type function floodFill(startX, startY, candyType, connectedGroup) { // Check bounds and if already visited if (startX < 0 || startX >= GRID_SIZE || startY < 0 || startY >= GRID_SIZE) { return; } if (visited[startX][startY]) { return; } var candy = gameGrid[startX][startY]; if (!candy || candy.candyType !== candyType) { return; } // Mark as visited and add to group visited[startX][startY] = true; connectedGroup.push(candy); // Check all 4 adjacent directions (up, down, left, right) floodFill(startX - 1, startY, candyType, connectedGroup); // left floodFill(startX + 1, startY, candyType, connectedGroup); // right floodFill(startX, startY - 1, candyType, connectedGroup); // up floodFill(startX, startY + 1, candyType, connectedGroup); // down } // Check each cell for connected groups for (var x = 0; x < GRID_SIZE; x++) { for (var y = 0; y < GRID_SIZE; y++) { if (!visited[x][y] && gameGrid[x][y]) { var connectedGroup = []; var candyType = gameGrid[x][y].candyType; // Find all connected candies of the same type floodFill(x, y, candyType, connectedGroup); // If we found 3 or more connected candies, add them to matches if (connectedGroup.length >= 3) { for (var i = 0; i < connectedGroup.length; i++) { matches.push(connectedGroup[i]); } } } } } return matches; } function removeMatches(matches) { if (matches.length === 0) return; LK.getSound('match').play(); for (var i = 0; i < matches.length; i++) { var candy = matches[i]; // Create particle explosion for each candy var candyColors = [0xff6b6b, 0x4ecdc4, 0x45b7d1, 0xf9ca24, 0xf0932b, 0xeb4d4b]; var particleColor = candyColors[candy.candyType - 1] || 0xffffff; // Create 8-12 particles per candy var particleCount = Math.floor(Math.random() * 5) + 8; for (var p = 0; p < particleCount; p++) { var particle = new Particle(particleColor, candy.x, candy.y); particles.push(particle); game.addChild(particle); } candy.markForRemoval(); gameGrid[candy.gridX][candy.gridY] = null; // Update score with animation var oldScore = score; score += 100; if (matches.length > 3) { score += (matches.length - 3) * 50; } // Animate score increase var scoreIncrease = score - oldScore; var tempScore = oldScore; tween({ score: tempScore }, { score: score }, { duration: 500, easing: tween.easeOut, onFinish: function onFinish() { scoreText.setText('Score: ' + score); } }); // Update score display during animation var scoreAnimationTimer = LK.setInterval(function () { tempScore += scoreIncrease / 30; // 30 steps over 500ms if (tempScore >= score) { tempScore = score; LK.clearInterval(scoreAnimationTimer); } scoreText.setText('Score: ' + Math.floor(tempScore)); }, 16); // ~60fps // Increment combo counter currentCombo++; // Show combo text based on match size and combo count var comboMessage = ""; var comboColor = 0xFFFFFF; if (matches.length >= 5) { comboMessage = "Fantastic!"; comboColor = 0xFF6B6B; // Screen shake for 5+ matches var shakeIntensity = 15; var originalX = game.x; var originalY = game.y; tween(game, { x: originalX + shakeIntensity, y: originalY + shakeIntensity * 0.5 }, { duration: 50, onFinish: function onFinish() { tween(game, { x: originalX - shakeIntensity, y: originalY - shakeIntensity * 0.5 }, { duration: 50, onFinish: function onFinish() { tween(game, { x: originalX + shakeIntensity * 0.5, y: originalY + shakeIntensity }, { duration: 50, onFinish: function onFinish() { tween(game, { x: originalX, y: originalY }, { duration: 50 }); } }); } }); } }); } else if (matches.length >= 4) { comboMessage = "Awesome!"; comboColor = 0x4ECDC4; // Screen shake for 4+ matches var shakeIntensity = 10; var originalX = game.x; var originalY = game.y; tween(game, { x: originalX + shakeIntensity, y: originalY }, { duration: 75, onFinish: function onFinish() { tween(game, { x: originalX - shakeIntensity, y: originalY }, { duration: 75, onFinish: function onFinish() { tween(game, { x: originalX, y: originalY }, { duration: 75 }); } }); } }); } else if (currentCombo >= 3) { comboMessage = "Great Combo!"; comboColor = 0xF9CA24; // Light screen shake for combo var shakeIntensity = 5; var originalX = game.x; var originalY = game.y; tween(game, { x: originalX + shakeIntensity }, { duration: 100, onFinish: function onFinish() { tween(game, { x: originalX - shakeIntensity }, { duration: 100, onFinish: function onFinish() { tween(game, { x: originalX }, { duration: 100 }); } }); } }); } else if (currentCombo >= 2) { comboMessage = "Great!"; comboColor = 0x45B7D1; } if (comboMessage !== "") { var comboX = 2048 / 2; var comboY = GRID_START_Y + GRID_SIZE * CELL_SIZE / 2; var comboText = new ComboText(comboMessage, comboX, comboY, comboColor); comboTexts.push(comboText); game.addChild(comboText); } } // Remove candies after animation LK.setTimeout(function () { for (var i = 0; i < matches.length; i++) { matches[i].destroy(); } applyGravity(); }, 250); } function applyGravity() { var needsGravity = false; // Apply gravity physics - make candies fall to fill empty spaces for (var x = 0; x < GRID_SIZE; x++) { // Collect all candies in this column that are not null var candiesInColumn = []; for (var y = 0; y < GRID_SIZE; y++) { if (gameGrid[x][y] !== null) { candiesInColumn.push({ candy: gameGrid[x][y], originalY: y }); } gameGrid[x][y] = null; // Clear the column } // Place candies back starting from bottom var newY = GRID_SIZE - 1; for (var i = candiesInColumn.length - 1; i >= 0; i--) { var candyData = candiesInColumn[i]; var candy = candyData.candy; var originalY = candyData.originalY; gameGrid[x][newY] = candy; // Immediately update grid position to prevent overlaps candy.gridX = x; candy.gridY = newY; // Check if candy needs to fall if (newY !== originalY) { var targetY = GRID_START_Y + newY * CELL_SIZE + CELL_SIZE / 2; candy.isAnimating = true; animatingCandies++; tween(candy, { y: targetY }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { candy.isAnimating = false; animatingCandies--; } }); needsGravity = true; } else { // Ensure position is correct even if not animating candy.x = GRID_START_X + x * CELL_SIZE + CELL_SIZE / 2; candy.y = GRID_START_Y + newY * CELL_SIZE + CELL_SIZE / 2; } newY--; } // Fill remaining empty spaces at top with new candies for (var y = 0; y < GRID_SIZE; y++) { if (gameGrid[x][y] === null) { var newCandy = createCandy(x, y, getRandomCandyType()); newCandy.y = GRID_START_Y - CELL_SIZE + CELL_SIZE / 2; newCandy.isAnimating = true; animatingCandies++; var targetY = GRID_START_Y + y * CELL_SIZE + CELL_SIZE / 2; tween(newCandy, { y: targetY }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { newCandy.isAnimating = false; animatingCandies--; } }); needsGravity = true; } } } if (needsGravity) { LK.getSound('cascade').play(); LK.setTimeout(function () { checkForNewMatches(); }, 400); } } function checkForNewMatches() { if (animatingCandies > 0) { LK.setTimeout(checkForNewMatches, 100); return; } var matches = findMatches(); if (matches.length > 0) { removeMatches(matches); } else { isProcessing = false; currentCombo = 0; // Reset combo counter when no more matches } } function checkGameState() { // Endless game - no win/lose conditions } function processMove(candy1, candy2) { if (isProcessing || !candy1 || !candy2 || candy1 === candy2) return false; if (!areAdjacent(candy1, candy2)) return false; isProcessing = true; // Endless game - no move limit // Temporarily swap to check for matches var tempX1 = candy1.gridX, tempY1 = candy1.gridY; var tempX2 = candy2.gridX, tempY2 = candy2.gridY; gameGrid[tempX1][tempY1] = candy2; gameGrid[tempX2][tempY2] = candy1; candy1.gridX = tempX2; candy1.gridY = tempY2; candy2.gridX = tempX1; candy2.gridY = tempY1; var matches = findMatches(); if (matches.length > 0) { // Valid move - perform the swap animation swapCandies(candy2, candy1); // Swap back positions for animation LK.setTimeout(function () { removeMatches(matches); }, 350); } else { // Invalid move - revert gameGrid[tempX1][tempY1] = candy1; gameGrid[tempX2][tempY2] = candy2; candy1.gridX = tempX1; candy1.gridY = tempY1; candy2.gridX = tempX2; candy2.gridY = tempY2; // Animate back to original positions swapCandies(candy1, candy2); LK.setTimeout(function () { isProcessing = false; }, 350); // Endless game - no move limit } return true; } game.down = function (x, y, obj) { if (gameState !== 'game') return; if (isProcessing) return; var candy = getCandyAt(x, y); if (!candy) return; if (selectedCandy) { if (selectedCandy === candy) { // Deselect tween(selectedCandy, { scaleX: 1, scaleY: 1 }, { duration: 150 }); selectedCandy = null; } else { // Try to make move var success = processMove(selectedCandy, candy); if (success) { tween(selectedCandy, { scaleX: 1, scaleY: 1 }, { duration: 150 }); selectedCandy = null; } } } else { // Select candy selectedCandy = candy; tween(candy, { scaleX: 1.2, scaleY: 1.2 }, { duration: 150 }); } }; // Create menu button (hamburger style with candy theme) var menuButton = null; function createMenuButton() { if (menuButton) return; // Create button background with glow effect var menuButtonGlow = LK.getAsset('gridCell', { anchorX: 0.5, anchorY: 0.5 }); menuButtonGlow.x = 1898; menuButtonGlow.y = 150; menuButtonGlow.scaleX = 0.6; menuButtonGlow.scaleY = 0.6; menuButtonGlow.tint = 0xFF69B4; menuButtonGlow.alpha = 0.3; var menuButtonBase = LK.getAsset('gridCell', { anchorX: 0.5, anchorY: 0.5 }); menuButtonBase.x = 1898; menuButtonBase.y = 150; menuButtonBase.scaleX = 0.5; menuButtonBase.scaleY = 0.5; menuButtonBase.tint = 0xFF69B4; // Create hamburger lines using candy assets (3 small candies stacked) var line1 = LK.getAsset('candy1', { anchorX: 0.5, anchorY: 0.5 }); line1.x = 1898; line1.y = 120; line1.scaleX = 0.15; line1.scaleY = 0.08; var line2 = LK.getAsset('candy2', { anchorX: 0.5, anchorY: 0.5 }); line2.x = 1898; line2.y = 150; line2.scaleX = 0.15; line2.scaleY = 0.08; var line3 = LK.getAsset('candy3', { anchorX: 0.5, anchorY: 0.5 }); line3.x = 1898; line3.y = 180; line3.scaleX = 0.15; line3.scaleY = 0.08; // Create container for the menu button menuButton = new Container(); menuButton.addChild(menuButtonGlow); menuButton.addChild(menuButtonBase); menuButton.addChild(line1); menuButton.addChild(line2); menuButton.addChild(line3); // Animate glow effect function animateMenuGlow() { tween(menuButtonGlow, { alpha: 0.6, scaleX: 0.7, scaleY: 0.7 }, { duration: 1500, easing: tween.easeInOut, onFinish: function onFinish() { tween(menuButtonGlow, { alpha: 0.3, scaleX: 0.6, scaleY: 0.6 }, { duration: 1500, easing: tween.easeInOut, onFinish: animateMenuGlow }); } }); } animateMenuGlow(); // Button click handler menuButton.down = function (x, y, obj) { // Button press animation tween(menuButtonBase, { scaleX: 0.4, scaleY: 0.4 }, { duration: 100, onFinish: function onFinish() { tween(menuButtonBase, { scaleX: 0.5, scaleY: 0.5 }, { duration: 100 }); } }); // Animate glow on press tween(menuButtonGlow, { alpha: 0.8, scaleX: 0.8, scaleY: 0.8 }, { duration: 150, onFinish: function onFinish() { tween(menuButtonGlow, { alpha: 0.3, scaleX: 0.6, scaleY: 0.6 }, { duration: 200 }); } }); // Return to main menu showMainMenu(); }; game.addChild(menuButton); gameElements.push(menuButton); menuButton.alpha = 0; // Initially hidden } // Coffee cup will be created when game starts // Start background music LK.playMusic('rahat'); // Show main menu instead of initializing game immediately showMainMenu(); game.update = function () { // Update menu elements when in menu state if (gameState === 'menu' && mainMenu) { mainMenu.update(); } // Update particles during game for (var i = particles.length - 1; i >= 0; i--) { particles[i].update(); } // Combo texts are automatically managed by their own animations // No manual update needed as they self-destruct // Background is now static image - no animation needed // Only run game physics during game state if (gameState === 'game') { // Continuously check for physics updates when not processing moves if (!isProcessing && animatingCandies === 0) { // Check if any candies need to fall due to physics var needsPhysicsUpdate = false; for (var x = 0; x < GRID_SIZE && !needsPhysicsUpdate; x++) { // Check entire column from bottom to top for any candy that should fall for (var y = GRID_SIZE - 1; y >= 0; y--) { if (gameGrid[x][y] === null) { // Found empty space, check if there's a candy above it for (var checkY = y - 1; checkY >= 0; checkY--) { if (gameGrid[x][checkY] !== null) { needsPhysicsUpdate = true; break; } } if (needsPhysicsUpdate) break; } } } if (needsPhysicsUpdate) { applyGravity(); } } } };
===================================================================
--- original.js
+++ change.js
@@ -324,38 +324,8 @@
howToPlayButtonText.anchor.set(0.5, 0.5);
howToPlayButtonText.x = howToPlayButton.x;
howToPlayButtonText.y = howToPlayButton.y;
self.addChild(howToPlayButtonText);
- // Enhanced language button with glow effect
- var languageButtonGlow = LK.getAsset('gridCell', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- languageButtonGlow.x = 2048 / 2;
- languageButtonGlow.y = 1800;
- languageButtonGlow.scaleX = 2.2;
- languageButtonGlow.scaleY = 0.9;
- languageButtonGlow.tint = 0xEB4D4B;
- languageButtonGlow.alpha = 0.3;
- self.addChild(languageButtonGlow);
- var languageButton = LK.getAsset('gridCell', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- languageButton.x = 2048 / 2;
- languageButton.y = 1800;
- languageButton.scaleX = 2;
- languageButton.scaleY = 0.8;
- languageButton.tint = 0xEB4D4B;
- self.addChild(languageButton);
- var languageButtonText = new Text2('🌐 LANGUAGE', {
- size: 90,
- fill: 0xFFFFFF
- });
- languageButtonText.anchor.set(0.5, 0.5);
- languageButtonText.x = languageButton.x;
- languageButtonText.y = languageButton.y;
- self.addChild(languageButtonText);
// Animate title with rainbow effect
self.animateTitle = function () {
// Scale animation
tween(titleText, {
@@ -453,26 +423,8 @@
onFinish: animateGlows
});
}
});
- tween(languageButtonGlow, {
- alpha: 0.6,
- scaleX: 2.4,
- scaleY: 1.0
- }, {
- duration: 1800,
- easing: tween.easeInOut,
- onFinish: function onFinish() {
- tween(languageButtonGlow, {
- alpha: 0.3,
- scaleX: 2.2,
- scaleY: 0.9
- }, {
- duration: 1800,
- easing: tween.easeInOut
- });
- }
- });
}
animateGlows();
// Update particles
self.update = function () {
@@ -572,54 +524,8 @@
if (typeof showHowToPlay === 'function') {
showHowToPlay();
}
};
- languageButton.down = function (x, y, obj) {
- // Button press animation with enhanced effects
- tween(languageButton, {
- scaleX: 1.7,
- scaleY: 0.6
- }, {
- duration: 80,
- onFinish: function onFinish() {
- tween(languageButton, {
- scaleX: 2.1,
- scaleY: 0.9
- }, {
- duration: 80,
- onFinish: function onFinish() {
- tween(languageButton, {
- scaleX: 2,
- scaleY: 0.8
- }, {
- duration: 80
- });
- }
- });
- }
- });
- // Animate button glow on press
- tween(languageButtonGlow, {
- alpha: 0.8,
- scaleX: 2.6,
- scaleY: 1.2
- }, {
- duration: 150,
- onFinish: function onFinish() {
- tween(languageButtonGlow, {
- alpha: 0.3,
- scaleX: 2.2,
- scaleY: 0.9
- }, {
- duration: 200
- });
- }
- });
- // Cycle through languages
- languageIndex = (languageIndex + 1) % languages.length;
- currentLanguage = languages[languageIndex];
- languageButtonText.setText('🌐 ' + currentLanguage);
- };
return self;
});
var MenuDecoration = Container.expand(function () {
var self = Container.call(this);
@@ -794,11 +700,8 @@
var gameState = 'menu'; // 'menu', 'game', 'howtoplay'
var mainMenu = null;
var howToPlayScreen = null;
var gameElements = [];
-var currentLanguage = 'English';
-var languages = ['English', 'Türkçe', 'Español', 'العربية', '日本語'];
-var languageIndex = 0;
// Initialize grid array
for (var x = 0; x < GRID_SIZE; x++) {
gameGrid[x] = [];
for (var y = 0; y < GRID_SIZE; y++) {
gerçekçi bir şeker. yuvarlak bir şeker ve kırmızı renk. In-Game asset. 2d. High contrast. No shadows
gerçekçi bir şeker. yuvarlak bir şeker ve pembe renk.. In-Game asset. 2d. High contrast. No shadows
gerçekçi bir şeker. yuvarlak bir şeker ve koyu mavi renk. aynı candy2 deki gibi In-Game asset. 2d. High contrast. No shadows
gerçekçi bir şeker. yuvarlak bir şeker ve sarı renk. aynı candy2 deki gibi olsun. In-Game asset. 2d. High contrast. No shadows
gerçekçi bir şeker. yuvarlak bir şeker ve kahverengi renk. aynı candy2 deki gibi olsun. In-Game asset. 2d. High contrast. No shadows
gerçekçi bir şeker. yuvarlak bir şeker ve yeşil renk. aynı candy2 deki gibi olsun. In-Game asset. 2d. High contrast. No shadows
a coffee. In-Game asset. 2d. High contrast. No shadows
Bir satırda oyundaki tüm şekerler yan yana dizilsin. In-Game asset. 2d. High contrast. No shadows
Yuvarlak bir şeker ve üstünde ona ucu değen sağ üstte bir kalem. In-Game asset. 2d. High contrast. No shadows