User prompt
hala geri gidiyor tek sorunun geri gitmesi başka sorun yok
User prompt
kuşun ileri veya geri gittiğini kontrol eden bir şey yap ve düzelt
User prompt
sen ileri ve geriyi bilmiyorsan sana şöyle söyleyeyim duvarların olduğu kısma doğru ilerlemesi gerekiyor sen yanlış yöne yönlendiriyorsun kuşu
User prompt
O zaman şunu da şöyle çözelim. Eğer kuş arkaya doğru ilerlemeye başlarsa bunu engelleyen ve öne doğru gitmesi için oluşan bir kod olsun.
User prompt
Kuş hala geriyə doğru ilərləyir. Düzəltəmiyorsan, başdan qodla o qısmı.
User prompt
Hala geriye doğru ilerliyor.
User prompt
Kuşun geriye doğru ilerlemesi ile ilgili bir hata var. Düzelt. İleri doğru ilerlemesi lazım.
User prompt
2 duvarı da koyu ve renge boya ve daha gerçekçi hale getir Flappy Bird oyunundaki gibi olsunlar
User prompt
hata vermeden oyundaki tüm hataları düzelt
User prompt
Kuşun ileri doğru ilerlemesi lazım.
User prompt
Kuş hala geriye doğru ilerliyor.
User prompt
Kuş yere çarptığında oyun bitiş menüsü çıkmıyor, kuş geriye doğru ilerliyor.
User prompt
Oyundaki tüm hataları düzelt ve daha düzgün hale getir.
User prompt
Duvarlar Flappy Bird'teki gibi yeşil, koyu ve böyle aynı oyundaki gibi renge sahip değil. Değiştir ve gerçekçiliğini artır.
User prompt
Oyundaki duvar görüntülerini daha düzgün, daha kaliteli, kasmayan ve daha gerçekçi bir hale getir. Gerçek Flappy Bird oyunundaki gibi olsun.
User prompt
Ayarlar ile ilgili herşeyi sil.
User prompt
Hız ayarlama düğmesinin bazı görünümleri kalmış onları da kaldır.
User prompt
Ayarlar kısmındaki hız sistemini tamamen kaldır.
User prompt
Ən iyi skoru oyundan çıxsaq bilə qaydat. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Duvarlar arası boşluğu biraz yani onlar duvarları birbirinden biraz daha uzaklaştır.
User prompt
hataları gider.
User prompt
eklentileri kaldır basit animasyonlarla hallet
User prompt
Ayarlar kısmında dil seçeneği çalışmıyor. Türkçe ve İngilizce düğmelerini ve dil desteğini düzelt. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
hız menüsündeki tuşların algılanması için düğmeleri büyüt
User prompt
hız göstergesi olan menüde tuşlar algılamıyor
/**** * Plugins ****/ var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Bird = Container.expand(function () { var self = Container.call(this); // Create bird graphics with proper anchoring var birdGraphics = self.attachAsset('bird', { anchorX: 0.5, anchorY: 0.5 }); // Initialize bird properties self.velocity = 0; self.flapCooldown = 0; // Optimized flap function self.flap = function () { // Prevent rapid flapping if (self.flapCooldown > 0) return; self.flapCooldown = 8; // Frames to wait before next flap // Set velocity with improved scaling for better responsiveness self.velocity = jumpStrength; // Play flap sound with minimal error handling try { LK.getSound('flap').play(); } catch (e) { // Silent fail } }; // Remove idle animation function self.startIdleAnimation = function () { // No animation needed }; // Optimized update method self.update = function () { // Update cooldowns if (self.flapCooldown > 0) self.flapCooldown--; if (!gameStarted) { // Pre-game idle state self.velocity = 0; self.y = 1366; return; } // Simple physics with improved scaling self.velocity += gravity; self.y += self.velocity; // Minimal rotation calculation - only every 10 frames if (LK.ticks % 10 === 0) { birdGraphics.rotation = self.velocity > 0 ? 0.8 : -0.4; } // Screen bounds collision if (self.y < 40) { self.y = 40; self.velocity = 0; } if (self.y > 2582) { self.y = 2582; self.velocity = 0; } }; return self; }); var Pipe = Container.expand(function (gapCenterY) { var self = Container.call(this); // Fixed gap size for consistent gameplay self.gapSize = 850; // Normal gap - increased for easier passage self.speed = pipeSpeed; self.passed = false; self.gapCenterY = gapCenterY; self.pipeWidth = 120; // Calculate pipe heights var topPipeHeight = Math.max(200, gapCenterY - self.gapSize / 2); var bottomPipeHeight = Math.max(200, 2732 - 150 - (gapCenterY + self.gapSize / 2)); // Simple top pipe - single element var topPipe = self.attachAsset('topPipe', { anchorX: 0.5, anchorY: 1 }); topPipe.y = gapCenterY - self.gapSize / 2; topPipe.height = topPipeHeight; topPipe.width = self.pipeWidth; topPipe.tint = 0x228b22; // Simple bottom pipe - single element var bottomPipe = self.attachAsset('bottomPipe', { anchorX: 0.5, anchorY: 0 }); bottomPipe.y = gapCenterY + self.gapSize / 2; bottomPipe.height = bottomPipeHeight; bottomPipe.width = self.pipeWidth; bottomPipe.tint = 0x228b22; // Simple pipe caps var topPipeCap = self.attachAsset('pipeTop', { anchorX: 0.5, anchorY: 1 }); topPipeCap.y = gapCenterY - self.gapSize / 2; topPipeCap.width = self.pipeWidth + 20; topPipeCap.height = 25; topPipeCap.tint = 0x32cd32; var bottomPipeCap = self.attachAsset('pipeBottom', { anchorX: 0.5, anchorY: 0 }); bottomPipeCap.y = gapCenterY + self.gapSize / 2; bottomPipeCap.width = self.pipeWidth + 20; bottomPipeCap.height = 25; bottomPipeCap.tint = 0x32cd32; self.update = function () { if (!gameStarted) { return; } // Use pre-calculated speed instead of calculating every frame self.x += self.speed; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game(); /**** * Game Code ****/ // Initialize persistent storage using storage plugin var currentLanguage = storage.language || 'tr'; var gameHighScore = storage.highScore || 0; // Simple animation helpers without tween plugin function simpleScale(target, endScale, duration, callback) { var startScale = target.scaleX || 1; var startTime = LK.ticks; var totalFrames = Math.floor(duration / 16.67); // 60fps var frameCount = 0; var animateInterval = LK.setInterval(function () { frameCount++; var progress = frameCount / totalFrames; if (progress >= 1) { progress = 1; LK.clearInterval(animateInterval); if (callback) callback(); } var currentScale = startScale + (endScale - startScale) * progress; target.scaleX = currentScale; target.scaleY = currentScale; }, 16); } function simpleColorTint(target, color, duration, callback) { var originalTint = target.tint; target.tint = color; if (duration > 0) { LK.setTimeout(function () { target.tint = originalTint; if (callback) callback(); }, duration); } else if (callback) { callback(); } } var bird; var pipes = []; var ground; var gameStarted = false; var gameOver = false; var showMainMenu = true; var showGameOver = false; var lastButtonClickTime = 0; // Track last button click time var gravity = 0.55; // Gravity for bird - fine-tuned for better control var jumpStrength = -9.5; // Jump strength for bird - fine-tuned for better balance var pipeSpeed = -3.5; // Pipe movement speed - increased for better challenge // Initialize storage with defaults var _storage = storage; // Create score text display var scoreTxt = new Text2('0', { size: 150, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); scoreTxt.stroke = 0x000000; scoreTxt.strokeThickness = 5; var lastScoreDisplayed = -1; // Cache last displayed score try { if (LK.gui && LK.gui.top) { LK.gui.top.addChild(scoreTxt); } } catch (e) { console.log("GUI score text error:", e); } // Create cup shape for score var cupShape; try { cupShape = LK.getAsset('cup', { anchorX: 0.5, anchorY: 0 }); cupShape.tint = 0xFFD700; if (LK.gui && LK.gui.bottomRight) { LK.gui.bottomRight.addChild(cupShape); cupShape.y = -230; cupShape.x = -100; } } catch (e) { console.log("Cup shape error:", e); } // Create main menu elements var mainMenuTitle = new Text2('FLAPPY BIRD', { size: 90, fill: 0xFFD700 }); mainMenuTitle.anchor.set(0.5, 0.5); mainMenuTitle.stroke = 0x000000; mainMenuTitle.strokeThickness = 5; try { if (LK.gui && LK.gui.center) { LK.gui.center.addChild(mainMenuTitle); mainMenuTitle.y = -280; } } catch (e) { console.log("Main menu title error:", e); } // Create instruction text var instructionTxt = new Text2('TIKLA VE OYNA!', { size: 50, fill: 0xFFFFFF }); instructionTxt.anchor.set(0.5, 0.5); instructionTxt.stroke = 0x000000; instructionTxt.strokeThickness = 3; instructionTxt.visible = false; instructionTxt.y = -50; // Remove background shape for instruction text - no longer needed LK.gui.center.addChild(instructionTxt); // Create game over screen elements var gameOverBg = LK.getAsset('topPipe', { anchorX: 0.5, anchorY: 0.5, width: 1600, height: 1200, alpha: 0.95 }); gameOverBg.tint = 0x2F4F4F; gameOverBg.visible = false; LK.gui.center.addChild(gameOverBg); var gameOverTitle = new Text2('OYUN BİTTİ', { size: 120, fill: 0xFFFFFF }); gameOverTitle.anchor.set(0.5, 0.5); gameOverTitle.stroke = 0x000000; gameOverTitle.strokeThickness = 6; gameOverTitle.visible = false; LK.gui.center.addChild(gameOverTitle); gameOverTitle.y = -300; var finalScoreText = new Text2('SKOR: 0', { size: 80, fill: 0xFFFFFF }); finalScoreText.anchor.set(0.5, 0.5); finalScoreText.stroke = 0x000000; finalScoreText.strokeThickness = 4; finalScoreText.visible = false; LK.gui.center.addChild(finalScoreText); finalScoreText.y = -150; var bestScoreText = new Text2('EN İYİ: 0', { size: 60, fill: 0xFFD700 }); bestScoreText.anchor.set(0.5, 0.5); bestScoreText.stroke = 0x000000; bestScoreText.strokeThickness = 3; bestScoreText.visible = false; LK.gui.center.addChild(bestScoreText); bestScoreText.y = -50; // Create retry button with enhanced styling var retryButton = LK.getAsset('playButtonOval', { anchorX: 0.5, anchorY: 0.5, width: 380, height: 110, alpha: 1.0 }); retryButton.tint = 0xFF9800; // Orange like original Flappy Bird retryButton.visible = false; LK.gui.center.addChild(retryButton); retryButton.y = 100; // Add retry button shadow for depth var retryButtonShadow = LK.getAsset('playButtonOval', { anchorX: 0.5, anchorY: 0.5, width: 380, height: 110, alpha: 0.3 }); retryButtonShadow.tint = 0xE65100; // Darker orange shadow retryButtonShadow.visible = false; LK.gui.center.addChild(retryButtonShadow); retryButtonShadow.y = 108; // Offset shadow slightly down retryButtonShadow.x = 4; // Offset shadow slightly right // Add retry button highlight var retryButtonHighlight = LK.getAsset('playButtonOval', { anchorX: 0.5, anchorY: 0.5, width: 350, height: 85, alpha: 0.4 }); retryButtonHighlight.tint = 0xFFB74D; // Lighter orange highlight retryButtonHighlight.visible = false; LK.gui.center.addChild(retryButtonHighlight); retryButtonHighlight.y = 92; // Offset highlight slightly up var retryButtonText = new Text2('TEKRAR DENE', { size: 44, fill: 0xFFFFFF }); retryButtonText.anchor.set(0.5, 0.5); retryButtonText.stroke = 0xE65100; retryButtonText.strokeThickness = 3; retryButtonText.visible = false; LK.gui.center.addChild(retryButtonText); retryButtonText.y = 100; // Create menu button with enhanced styling var menuButton = LK.getAsset('playButtonOval', { anchorX: 0.5, anchorY: 0.5, width: 380, height: 110, alpha: 1.0 }); menuButton.tint = 0xF44336; // Red like original Flappy Bird menuButton.visible = false; LK.gui.center.addChild(menuButton); menuButton.y = 250; // Add menu button shadow for depth var menuButtonShadow = LK.getAsset('playButtonOval', { anchorX: 0.5, anchorY: 0.5, width: 380, height: 110, alpha: 0.3 }); menuButtonShadow.tint = 0xD32F2F; // Darker red shadow menuButtonShadow.visible = false; LK.gui.center.addChild(menuButtonShadow); menuButtonShadow.y = 258; // Offset shadow slightly down menuButtonShadow.x = 4; // Offset shadow slightly right // Add menu button highlight var menuButtonHighlight = LK.getAsset('playButtonOval', { anchorX: 0.5, anchorY: 0.5, width: 350, height: 85, alpha: 0.4 }); menuButtonHighlight.tint = 0xEF5350; // Lighter red highlight menuButtonHighlight.visible = false; LK.gui.center.addChild(menuButtonHighlight); menuButtonHighlight.y = 242; // Offset highlight slightly up var menuButtonText = new Text2('ANA MENÜ', { size: 44, fill: 0xFFFFFF }); menuButtonText.anchor.set(0.5, 0.5); menuButtonText.stroke = 0xD32F2F; menuButtonText.strokeThickness = 3; menuButtonText.visible = false; LK.gui.center.addChild(menuButtonText); menuButtonText.y = 250; // Simple background setup var background = game.addChild(LK.getAsset('background', { anchorX: 0, anchorY: 0 })); background.x = 0; background.y = 0; background.scaleX = 2; background.scaleY = 2; // Create ground ground = game.addChild(LK.getAsset('ground', { anchorX: 0, anchorY: 1 })); ground.x = 0; ground.y = 2732; ground.tint = 0x654321; // Create bird - position in open area away from any walls bird = game.addChild(new Bird()); bird.x = 300; // Position bird further back in open area bird.y = 1366; // Initialize bird properly bird.velocity = 0; // Pre-generate all pipes function function generateAllPipes() { // Define safe boundaries for gap center to ensure both pipes have reasonable heights var minGapY = 700; // Increased minimum gap center position for better clearance var maxGapY = 1900; // Adjusted maximum gap center position for better clearance // Generate fewer pipes to prevent memory issues var totalPipesNeeded = 100; // Reduced from 1000 to 100 var currentX = 1200; // Starting position ahead of bird var pipeSpacing = 450; // Fixed spacing between pipes for (var pipeIndex = 0; pipeIndex < totalPipesNeeded; pipeIndex++) { var gapCenterY; // Create more varied random patterns with better distribution var randomPattern = Math.random(); if (randomPattern < 0.4) { // 40% chance for high gaps (easier to navigate) gapCenterY = minGapY + Math.random() * 300; } else if (randomPattern < 0.7) { // 30% chance for middle gaps (moderate difficulty) gapCenterY = 1000 + Math.random() * 500; } else { // 30% chance for low gaps (more challenging but still passable) gapCenterY = maxGapY - Math.random() * 300; } // Add some variation based on pipe index for progressive difficulty if (pipeIndex > 10) { // After pipe 10, make gaps slightly more challenging var difficultyFactor = Math.min(0.8, pipeIndex / 50); // Max 80% difficulty increase var centerPull = 1300; // Pull towards center-high area gapCenterY = gapCenterY + (centerPull - gapCenterY) * difficultyFactor * 0.3; } // Ensure the gap stays within safe boundaries gapCenterY = Math.max(minGapY, Math.min(maxGapY, gapCenterY)); var pipe = new Pipe(gapCenterY); pipe.x = currentX; pipe.passed = false; pipes.push(pipe); game.addChild(pipe); // Move to next pipe position currentX += pipeSpacing; } } // Reset game function function resetGame() { // Reset bird - position it in open area with no walls bird.x = 300; // Position bird in open area bird.y = 1366; bird.velocity = 0; // Clear pipes for (var i = pipes.length - 1; i >= 0; i--) { pipes[i].destroy(); } pipes = []; // Reset variables gameStarted = false; gameOver = false; showMainMenu = true; showGameOver = false; // Hide game over screen hideGameOverScreen(); LK.setScore(0); scoreTxt.setText('0'); // Show main menu mainMenuTitle.visible = true; // Show play button elements if (playButton) playButton.visible = true; if (playButtonShadow) playButtonShadow.visible = true; if (playButtonHighlight) playButtonHighlight.visible = true; if (playButtonText) playButtonText.visible = true; // Show cup shape (high score indicator) if (cupShape) cupShape.visible = true; // Show main language button elements if (mainLanguageButton) mainLanguageButton.visible = true; if (mainLanguageButtonShadow) mainLanguageButtonShadow.visible = true; if (mainLanguageButtonHighlight) mainLanguageButtonHighlight.visible = true; if (mainLanguageButtonText) mainLanguageButtonText.visible = true; // Hide instruction instructionTxt.visible = false; generateAllPipes(); } // Function to start game from main menu function startGameFromMenu() { showMainMenu = false; // Hide main menu elements mainMenuTitle.visible = false; // Hide play button elements if (playButton) playButton.visible = false; if (playButtonShadow) playButtonShadow.visible = false; if (playButtonHighlight) playButtonHighlight.visible = false; if (playButtonText) playButtonText.visible = false; // Hide cup shape (high score indicator) if (cupShape) cupShape.visible = false; // Hide main language button elements if (mainLanguageButton) mainLanguageButton.visible = false; if (mainLanguageButtonShadow) mainLanguageButtonShadow.visible = false; if (mainLanguageButtonHighlight) mainLanguageButtonHighlight.visible = false; if (mainLanguageButtonText) mainLanguageButtonText.visible = false; // Show instruction instructionTxt.visible = true; } // Function to show game over screen function showGameOverScreen(finalScore) { showGameOver = true; gameStarted = false; showMainMenu = false; // Hide instruction instructionTxt.visible = false; // Show game over elements gameOverBg.visible = true; gameOverTitle.visible = true; finalScoreText.visible = true; bestScoreText.visible = true; retryButton.visible = true; retryButtonText.visible = true; retryButtonShadow.visible = true; retryButtonHighlight.visible = true; menuButton.visible = true; menuButtonText.visible = true; menuButtonShadow.visible = true; menuButtonHighlight.visible = true; // Update score displays finalScoreText.setText(getText('score') + ': ' + finalScore); // Use proper text sizing if (finalScoreText.width > 600) { var newSize = Math.max(50, Math.floor(80 * 600 / finalScoreText.width)); if (finalScoreText.style.size !== newSize) { finalScoreText.style = { size: newSize, fill: finalScoreText.style.fill }; } } // Always show the current high score from persistent storage var currentHighScore = storage.highScore || 0; bestScoreText.setText(getText('bestScore') + ': ' + currentHighScore); // Use proper text sizing if (bestScoreText.width > 600) { var newSize = Math.max(40, Math.floor(60 * 600 / bestScoreText.width)); bestScoreText.style = { size: newSize, fill: bestScoreText.style.fill }; } // Simple game over screen display - no animations } // Function to hide game over screen function hideGameOverScreen() { showGameOver = false; // Hide game over elements gameOverBg.visible = false; gameOverTitle.visible = false; finalScoreText.visible = false; bestScoreText.visible = false; retryButton.visible = false; retryButtonText.visible = false; retryButtonShadow.visible = false; retryButtonHighlight.visible = false; menuButton.visible = false; menuButtonText.visible = false; menuButtonShadow.visible = false; menuButtonHighlight.visible = false; } // Create language overlay background var languageOverlay = LK.getAsset('topPipe', { anchorX: 0.5, anchorY: 0.5, width: 2048, height: 2732, alpha: 1.0 }); languageOverlay.tint = 0x2F4F4F; languageOverlay.visible = false; LK.gui.center.addChild(languageOverlay); // Create language control title var languageTitle = new Text2('DİL SEÇENEKLERİ', { size: 80, fill: 0xFFFFFF }); languageTitle.anchor.set(0.5, 0.5); languageTitle.stroke = 0x000000; languageTitle.strokeThickness = 4; languageTitle.visible = false; LK.gui.center.addChild(languageTitle); languageTitle.y = -200; // Create language option buttons with modern rectangular design var turkishButton = LK.getAsset('settingsButtonRect', { anchorX: 0.5, anchorY: 0.5, width: 260, height: 65, alpha: 1.0 }); turkishButton.tint = 0x27AE60; turkishButton.visible = false; LK.gui.center.addChild(turkishButton); turkishButton.y = -80; turkishButton.x = -220; // Add Turkish button shadow var turkishButtonShadow = LK.getAsset('settingsButtonRect', { anchorX: 0.5, anchorY: 0.5, width: 260, height: 65, alpha: 0.3 }); turkishButtonShadow.tint = 0x1E8449; turkishButtonShadow.visible = false; LK.gui.center.addChild(turkishButtonShadow); turkishButtonShadow.y = -75; turkishButtonShadow.x = -217; // Add Turkish button highlight var turkishButtonHighlight = LK.getAsset('settingsButtonRect', { anchorX: 0.5, anchorY: 0.5, width: 240, height: 50, alpha: 0.4 }); turkishButtonHighlight.tint = 0x58D68D; turkishButtonHighlight.visible = false; LK.gui.center.addChild(turkishButtonHighlight); turkishButtonHighlight.y = -85; turkishButtonHighlight.x = -220; var turkishText = new Text2('TÜRKÇE', { size: 32, fill: 0xFFFFFF }); turkishText.anchor.set(0.5, 0.5); turkishText.stroke = 0x1E8449; turkishText.strokeThickness = 2; turkishText.visible = false; LK.gui.center.addChild(turkishText); turkishText.y = -80; turkishText.x = -220; var englishButton = LK.getAsset('settingsButtonRect', { anchorX: 0.5, anchorY: 0.5, width: 260, height: 65, alpha: 1.0 }); englishButton.tint = 0x3498DB; englishButton.visible = false; LK.gui.center.addChild(englishButton); englishButton.y = -80; englishButton.x = 220; // Add English button shadow var englishButtonShadow = LK.getAsset('settingsButtonRect', { anchorX: 0.5, anchorY: 0.5, width: 260, height: 65, alpha: 0.3 }); englishButtonShadow.tint = 0x2980B9; englishButtonShadow.visible = false; LK.gui.center.addChild(englishButtonShadow); englishButtonShadow.y = -75; englishButtonShadow.x = 223; // Add English button highlight var englishButtonHighlight = LK.getAsset('settingsButtonRect', { anchorX: 0.5, anchorY: 0.5, width: 240, height: 50, alpha: 0.4 }); englishButtonHighlight.tint = 0x85C1E9; englishButtonHighlight.visible = false; LK.gui.center.addChild(englishButtonHighlight); englishButtonHighlight.y = -85; englishButtonHighlight.x = 220; var englishText = new Text2('ENGLISH', { size: 32, fill: 0xFFFFFF }); englishText.anchor.set(0.5, 0.5); englishText.stroke = 0x2980B9; englishText.strokeThickness = 2; englishText.visible = false; LK.gui.center.addChild(englishText); englishText.y = -80; englishText.x = 220; // Current language indicator var currentLanguageText = new Text2('MEVCUT: TÜRKÇE', { size: 50, fill: 0xFFD700 }); currentLanguageText.anchor.set(0.5, 0.5); currentLanguageText.stroke = 0x000000; currentLanguageText.strokeThickness = 3; currentLanguageText.visible = false; LK.gui.center.addChild(currentLanguageText); currentLanguageText.y = 30; // Create back button for language controls with modern rectangular design var languageBackButton = LK.getAsset('settingsButtonRect', { anchorX: 0.5, anchorY: 0.5, width: 220, height: 65, alpha: 1.0 }); languageBackButton.tint = 0x7F8C8D; languageBackButton.visible = false; LK.gui.center.addChild(languageBackButton); languageBackButton.y = 150; // Add language back button shadow var languageBackButtonShadow = LK.getAsset('settingsButtonRect', { anchorX: 0.5, anchorY: 0.5, width: 220, height: 65, alpha: 0.3 }); languageBackButtonShadow.tint = 0x566573; languageBackButtonShadow.visible = false; LK.gui.center.addChild(languageBackButtonShadow); languageBackButtonShadow.y = 155; languageBackButtonShadow.x = 3; // Add language back button highlight var languageBackButtonHighlight = LK.getAsset('settingsButtonRect', { anchorX: 0.5, anchorY: 0.5, width: 200, height: 50, alpha: 0.4 }); languageBackButtonHighlight.tint = 0xABB2B9; languageBackButtonHighlight.visible = false; LK.gui.center.addChild(languageBackButtonHighlight); languageBackButtonHighlight.y = 145; var languageBackText = new Text2('GERİ', { size: 36, fill: 0xFFFFFF }); languageBackText.anchor.set(0.5, 0.5); languageBackText.stroke = 0x566573; languageBackText.strokeThickness = 2; languageBackText.visible = false; LK.gui.center.addChild(languageBackText); languageBackText.y = 150; // Function to show language controls function showLanguageControls() { // Hide main menu elements mainMenuTitle.visible = false; if (playButton) playButton.visible = false; if (playButtonShadow) playButtonShadow.visible = false; if (playButtonHighlight) playButtonHighlight.visible = false; if (playButtonText) playButtonText.visible = false; if (cupShape) cupShape.visible = false; // Hide main language button elements if (mainLanguageButton) mainLanguageButton.visible = false; if (mainLanguageButtonShadow) mainLanguageButtonShadow.visible = false; if (mainLanguageButtonHighlight) mainLanguageButtonHighlight.visible = false; if (mainLanguageButtonText) mainLanguageButtonText.visible = false; // Show language controls languageOverlay.visible = true; languageTitle.visible = true; turkishButton.visible = true; turkishButtonShadow.visible = true; turkishButtonHighlight.visible = true; turkishText.visible = true; englishButton.visible = true; englishButtonShadow.visible = true; englishButtonHighlight.visible = true; englishText.visible = true; currentLanguageText.visible = true; languageBackButton.visible = true; languageBackButtonShadow.visible = true; languageBackButtonHighlight.visible = true; languageBackText.visible = true; updateLanguageDisplay(); } // Function to hide language controls function hideLanguageControls() { // Hide all language control elements languageOverlay.visible = false; languageTitle.visible = false; turkishButton.visible = false; turkishButtonShadow.visible = false; turkishButtonHighlight.visible = false; turkishText.visible = false; englishButton.visible = false; englishButtonShadow.visible = false; englishButtonHighlight.visible = false; englishText.visible = false; currentLanguageText.visible = false; languageBackButton.visible = false; languageBackButtonShadow.visible = false; languageBackButtonHighlight.visible = false; languageBackText.visible = false; // Show main menu elements again if (showMainMenu) { mainMenuTitle.visible = true; if (playButton) playButton.visible = true; if (playButtonShadow) playButtonShadow.visible = true; if (playButtonHighlight) playButtonHighlight.visible = true; if (playButtonText) playButtonText.visible = true; if (cupShape) cupShape.visible = true; if (mainLanguageButton) mainLanguageButton.visible = true; if (mainLanguageButtonShadow) mainLanguageButtonShadow.visible = true; if (mainLanguageButtonHighlight) mainLanguageButtonHighlight.visible = true; if (mainLanguageButtonText) mainLanguageButtonText.visible = true; } } // Language text objects var languageTexts = { tr: { mainTitle: 'FLAPPY BIRD', playButton: 'OYNA', instruction: 'TIKLA VE OYNA!', gameOver: 'OYUN BİTTİ', score: 'SKOR', bestScore: 'EN İYİ', retry: 'TEKRAR DENE', mainMenu: 'ANA MENÜ', language: 'DİL', languageTitle: 'DİL SEÇENEKLERİ', current: 'MEVCUT', highestScore: 'EN YÜKSEK', back: 'GERİ' }, en: { mainTitle: 'FLAPPY BIRD', playButton: 'PLAY', instruction: 'CLICK TO PLAY!', gameOver: 'GAME OVER', score: 'SCORE', bestScore: 'BEST', retry: 'RETRY', mainMenu: 'MAIN MENU', language: 'LANGUAGE', languageTitle: 'LANGUAGE OPTIONS', current: 'CURRENT', highestScore: 'HIGHEST SCORE', back: 'BACK' } }; // Function to get text for current language function getText(key) { return languageTexts[currentLanguage][key] || languageTexts['en'][key]; } // Function to update all text elements to current language function updateAllTexts() { try { if (instructionTxt && instructionTxt.setText) { try { instructionTxt.setText(getText('instruction')); } catch (e) {} } if (playButtonText && playButtonText.setText) { try { playButtonText.setText(getText('playButton')); } catch (e) {} } if (gameOverTitle && gameOverTitle.setText) { try { gameOverTitle.setText(getText('gameOver')); } catch (e) {} } if (retryButtonText && retryButtonText.setText) { try { retryButtonText.setText(getText('retry')); } catch (e) {} } if (menuButtonText && menuButtonText.setText) { try { menuButtonText.setText(getText('mainMenu')); } catch (e) {} } if (languageTitle && languageTitle.setText) { try { languageTitle.setText(getText('languageTitle')); } catch (e) {} } if (languageBackText && languageBackText.setText) { try { languageBackText.setText(getText('back')); } catch (e) {} } if (mainLanguageButtonText && mainLanguageButtonText.setText) { try { mainLanguageButtonText.setText(getText('language')); } catch (e) {} } // Update final and best score texts if (finalScoreText && finalScoreText.setText) { var currentScore = LK.getScore(); try { finalScoreText.setText(getText('score') + ': ' + currentScore); } catch (e) {} } if (bestScoreText && bestScoreText.setText) { var currentHighScore = storage.highScore || 0; try { bestScoreText.setText(getText('bestScore') + ': ' + currentHighScore); } catch (e) {} } } catch (e) { console.log("Text update error:", e); } } // Function to update language display function updateLanguageDisplay() { var langText = currentLanguage === 'tr' ? 'TÜRKÇE' : 'ENGLISH'; var currentText = currentLanguage === 'tr' ? 'MEVCUT' : 'CURRENT'; if (currentLanguageText && currentLanguageText.setText) { try { currentLanguageText.setText(currentText + ': ' + langText); } catch (e) {} } // Update button colors to show selected language if (turkishButton) { turkishButton.tint = currentLanguage === 'tr' ? 0x2ECC71 : 0x27AE60; } if (englishButton) { englishButton.tint = currentLanguage === 'en' ? 0x5DADE2 : 0x3498DB; } // Ensure button text is always correct if (turkishText && turkishText.setText) { try { turkishText.setText('TÜRKÇE'); } catch (e) {} } if (englishText && englishText.setText) { try { englishText.setText('ENGLISH'); } catch (e) {} } } // Function to set language function setLanguage(lang) { currentLanguage = lang; // Save to persistent storage storage.language = lang; // Update all text elements immediately updateAllTexts(); // Update language display updateLanguageDisplay(); } // Initialize persistent storage with defaults if values don't exist if (!storage.globalLeaderboardNames) storage.globalLeaderboardNames = []; if (!storage.globalLeaderboardScores) storage.globalLeaderboardScores = []; if (typeof storage.highScore === 'undefined') storage.highScore = 0; if (typeof storage.lastScore === 'undefined') storage.lastScore = 0; if (!storage.language) storage.language = 'tr'; if (!storage.username) storage.username = 'Oyuncu1'; // Update current language from persistent storage currentLanguage = storage.language || 'tr'; // Initialize username if not exists if (!storage.username) { var playerNumber = 1; while (storage.globalLeaderboardNames.indexOf('Oyuncu ' + playerNumber) !== -1) { playerNumber++; } storage.username = 'Oyuncu ' + playerNumber; } // Create animated play button for main menu var playButton = LK.getAsset('playButtonMain', { anchorX: 0.5, anchorY: 0.5, width: 400, height: 120, alpha: 1.0 }); playButton.tint = 0xFF9800; // Flappy Bird orange try { if (LK.gui && LK.gui.center) { LK.gui.center.addChild(playButton); playButton.y = -100; } } catch (e) { console.log("Play button error:", e); } // Create language button for direct access from main menu var mainLanguageButton = LK.getAsset('playButtonOval', { anchorX: 0.5, anchorY: 0.5, width: 300, height: 80, alpha: 1.0 }); mainLanguageButton.tint = 0x9B59B6; try { if (LK.gui && LK.gui.center) { LK.gui.center.addChild(mainLanguageButton); mainLanguageButton.y = 50; } } catch (e) { console.log("Main language button error:", e); } // Create language button shadow var mainLanguageButtonShadow = LK.getAsset('playButtonOval', { anchorX: 0.5, anchorY: 0.5, width: 300, height: 80, alpha: 0.3 }); mainLanguageButtonShadow.tint = 0x8E44AD; try { if (LK.gui && LK.gui.center) { LK.gui.center.addChild(mainLanguageButtonShadow); mainLanguageButtonShadow.y = 55; mainLanguageButtonShadow.x = 3; } } catch (e) { console.log("Main language button shadow error:", e); } // Create language button highlight var mainLanguageButtonHighlight = LK.getAsset('playButtonOval', { anchorX: 0.5, anchorY: 0.5, width: 280, height: 65, alpha: 0.4 }); mainLanguageButtonHighlight.tint = 0xBB8FCE; try { if (LK.gui && LK.gui.center) { LK.gui.center.addChild(mainLanguageButtonHighlight); mainLanguageButtonHighlight.y = 45; } } catch (e) { console.log("Main language button highlight error:", e); } // Create language button text var mainLanguageButtonText = new Text2('DİL', { size: 36, fill: 0xFFFFFF }); mainLanguageButtonText.anchor.set(0.5, 0.5); mainLanguageButtonText.stroke = 0x8E44AD; mainLanguageButtonText.strokeThickness = 2; try { if (LK.gui && LK.gui.center) { LK.gui.center.addChild(mainLanguageButtonText); mainLanguageButtonText.y = 50; } } catch (e) { console.log("Main language button text error:", e); } // Create separate play button shadow element var playButtonShadow = LK.getAsset('playButtonShadow', { anchorX: 0.5, anchorY: 0.5, width: 400, height: 120, alpha: 0.4 }); playButtonShadow.tint = 0xE65100; // Darker orange shadow try { if (LK.gui && LK.gui.center) { LK.gui.center.addChild(playButtonShadow); playButtonShadow.y = -92; // Offset shadow slightly up playButtonShadow.x = 4; // Offset shadow slightly right } } catch (e) { console.log("Play button shadow error:", e); } // Create separate play button highlight element var playButtonHighlight = LK.getAsset('playButtonHighlight', { anchorX: 0.5, anchorY: 0.5, width: 370, height: 95, alpha: 0.5 }); playButtonHighlight.tint = 0xFFB74D; // Lighter orange highlight try { if (LK.gui && LK.gui.center) { LK.gui.center.addChild(playButtonHighlight); playButtonHighlight.y = -108; // Offset highlight slightly down } } catch (e) { console.log("Play button highlight error:", e); } // Create separate play button text element var playButtonText = new Text2('OYNA', { size: 50, fill: 0xFFFFFF }); playButtonText.anchor.set(0.5, 0.5); playButtonText.stroke = 0xE65100; playButtonText.strokeThickness = 4; try { if (LK.gui && LK.gui.center) { LK.gui.center.addChild(playButtonText); playButtonText.y = -100; } } catch (e) { console.log("Play button text error:", e); } // Initialize game resetGame(); // Use resetGame to properly initialize all states // Update all texts to current language updateAllTexts(); // Update language display to show current selection updateLanguageDisplay(); // Touch/click handler game.down = function (x, y, obj) { // Check if language overlay is visible and handle language controls if (languageOverlay.visible) { // Turkish language button with isolated click area if (turkishButton.visible && x >= 654 && x <= 954 && y >= 1246 && y <= 1326) { var currentTime = Date.now(); if (currentTime - lastButtonClickTime < 300) return; lastButtonClickTime = currentTime; // Simple visual feedback with color change simpleColorTint(turkishButton, 0x58D68D, 150); setLanguage('tr'); return; } // Barrier zone between Turkish and English buttons (x: 954-1094) if (x >= 954 && x <= 1094 && y >= 1246 && y <= 1326) { return; // Block clicks in barrier zone } // English language button with isolated click area if (englishButton.visible && x >= 1094 && x <= 1394 && y >= 1246 && y <= 1326) { var currentTime = Date.now(); if (currentTime - lastButtonClickTime < 300) return; lastButtonClickTime = currentTime; // Simple visual feedback with color change simpleColorTint(englishButton, 0x85C1E9, 150); setLanguage('en'); return; } // Check language back button at x = 1024, y = 1516, size 300x100 if (languageBackButton.visible && x >= 874 && x <= 1174 && y >= 1466 && y <= 1566) { var currentTime = Date.now(); if (currentTime - lastButtonClickTime < 300) return; lastButtonClickTime = currentTime; // Simple visual feedback with color change simpleColorTint(languageBackButton, 0xABB2B9, 150); hideLanguageControls(); return; } return; // Don't process other clicks when language overlay is open } // Check cup click - cup is positioned at bottomRight with offset var cupX = 2048 - 100; // bottomRight.x + cupShape.x offset var cupY = 2732 - 230; // bottomRight.y + cupShape.y offset var cupSize = 120; // Cup asset size if (x >= cupX - cupSize / 2 && x <= cupX + cupSize / 2 && y >= cupY && y <= cupY + cupSize) { var currentTime = Date.now(); if (currentTime - lastButtonClickTime < 500) return; lastButtonClickTime = currentTime; // Simple high score display from persistent storage var highScore = storage.highScore || 0; console.log(getText('highestScore') + ': ' + highScore); return; } if (gameOver || showGameOver) { // Check retry button (TEKRAR DENE) - centered at 1024x1466, button is 380x110 if (x >= 834 && x <= 1214 && y >= 1411 && y <= 1521) { // Prevent rapid clicks var currentTime = Date.now(); if (currentTime - lastButtonClickTime < 300) { return; // Ignore click if too recent } lastButtonClickTime = currentTime; // Simple visual feedback with color change simpleColorTint(retryButton, 0xFFB74D, 150); hideGameOverScreen(); resetGame(); // Show instruction screen instead of starting game directly startGameFromMenu(); return; } // Check menu button (ANA MENÜ) - centered at 1024x1616, button is 380x110 if (x >= 834 && x <= 1214 && y >= 1561 && y <= 1671) { // Prevent rapid clicks var currentTime = Date.now(); if (currentTime - lastButtonClickTime < 300) { return; // Ignore click if too recent } lastButtonClickTime = currentTime; // Simple visual feedback with color change simpleColorTint(menuButton, 0xF1948A, 150); hideGameOverScreen(); resetGame(); return; } return; } if (showMainMenu) { // Check play button click - centered at 1024x1266 (center.y = 1366 + playButton.y = -100), button is 400x120 if (playButton && playButton.visible && x >= 824 && x <= 1224 && y >= 1206 && y <= 1326) { // Prevent rapid clicks var currentTime = Date.now(); if (currentTime - lastButtonClickTime < 300) { return; // Ignore click if too recent } lastButtonClickTime = currentTime; // Simple visual feedback with color change simpleColorTint(playButton, 0xFFB74D, 100); startGameFromMenu(); return; } // Check main language button click - centered at 1024x1416 (center.y = 1366 + mainLanguageButton.y = 50), button is 300x80 if (mainLanguageButton && mainLanguageButton.visible && x >= 874 && x <= 1174 && y >= 1376 && y <= 1456) { var currentTime = Date.now(); if (currentTime - lastButtonClickTime < 300) { return; // Ignore click if too recent } lastButtonClickTime = currentTime; // Simple visual feedback with color change simpleColorTint(mainLanguageButton, 0xBB8FCE, 150); showLanguageControls(); return; } return; } if (!gameStarted) { gameStarted = true; instructionTxt.visible = false; } bird.flap(); }; // Main game loop game.update = function () { if (gameOver || showMainMenu || showGameOver) return; // Only run game logic if game has started if (gameStarted) { // Check ground and ceiling collision with proper bird size (bird is 80px tall, 120px wide) var birdRadius = 40; // Half of bird height for collision detection if (bird.y + birdRadius >= 2732 - 150 || bird.y - birdRadius <= 0) { gameOver = true; var currentScore = LK.getScore(); // Save score to persistent storage if (currentScore > (storage.highScore || 0)) { storage.highScore = currentScore; } storage.lastScore = currentScore; showGameOverScreen(currentScore); return; } // Ultra-simplified pipe cleanup - only run every 60 frames if (LK.ticks % 60 === 0) { var cleanupCount = 0; for (var i = pipes.length - 1; i >= 0 && cleanupCount < 5; i--) { var pipe = pipes[i]; if (pipe && pipe.x < bird.x - 600) { pipe.destroy(); pipes.splice(i, 1); cleanupCount++; } } } // Ultra-simplified collision - only check closest pipe var closestPipe = null; var minDistance = 1000; for (var i = 0; i < pipes.length; i++) { var pipe = pipes[i]; var distance = pipe.x - bird.x; if (distance > -100 && distance < 200 && distance < minDistance) { closestPipe = pipe; minDistance = distance; } } if (closestPipe) { // Initialize lastX tracking if (typeof closestPipe.lastX === 'undefined') { closestPipe.lastX = closestPipe.x; } // Scoring check if (!closestPipe.passed && closestPipe.lastX >= bird.x && closestPipe.x < bird.x) { closestPipe.passed = true; var newScore = LK.getScore() + 1; LK.setScore(newScore); scoreTxt.setText(newScore.toString()); try { LK.getSound('score').play(); } catch (e) {} } // Update last position closestPipe.lastX = closestPipe.x; // Collision check - only if very close if (closestPipe.x > bird.x - 80 && closestPipe.x < bird.x + 80) { var gapTop = closestPipe.gapCenterY - closestPipe.gapSize / 2; var gapBottom = closestPipe.gapCenterY + closestPipe.gapSize / 2; if (bird.y < gapTop + 40 || bird.y > gapBottom - 40) { gameOver = true; var currentScore = LK.getScore(); storage.lastScore = currentScore; if (currentScore > (storage.highScore || 0)) { storage.highScore = currentScore; } showGameOverScreen(currentScore); return; } } } } };
===================================================================
--- original.js
+++ change.js
@@ -368,194 +368,8 @@
menuButtonText.strokeThickness = 3;
menuButtonText.visible = false;
LK.gui.center.addChild(menuButtonText);
menuButtonText.y = 250;
-// Create separate settings button element
-var settingsButton = LK.getAsset('playButtonOval', {
- anchorX: 0.5,
- anchorY: 0.5,
- width: 100,
- height: 100,
- alpha: 1.0
-});
-settingsButton.tint = 0x8E44AD;
-try {
- if (LK.gui && LK.gui.topRight) {
- LK.gui.topRight.addChild(settingsButton);
- settingsButton.x = -80;
- settingsButton.y = 80;
- }
-} catch (e) {
- console.log("Settings button error:", e);
-}
-// Create separate settings button shadow element
-var settingsButtonShadow = LK.getAsset('playButtonOval', {
- anchorX: 0.5,
- anchorY: 0.5,
- width: 100,
- height: 100,
- alpha: 0.3
-});
-settingsButtonShadow.tint = 0x6B2C91; // Darker purple shadow
-try {
- if (LK.gui && LK.gui.topRight) {
- LK.gui.topRight.addChild(settingsButtonShadow);
- settingsButtonShadow.x = -77;
- settingsButtonShadow.y = 83;
- }
-} catch (e) {
- console.log("Settings button shadow error:", e);
-}
-// Create separate settings button highlight element
-var settingsButtonHighlight = LK.getAsset('playButtonOval', {
- anchorX: 0.5,
- anchorY: 0.5,
- width: 85,
- height: 85,
- alpha: 0.4
-});
-settingsButtonHighlight.tint = 0xBB8FCE; // Lighter purple highlight
-try {
- if (LK.gui && LK.gui.topRight) {
- LK.gui.topRight.addChild(settingsButtonHighlight);
- settingsButtonHighlight.x = -80;
- settingsButtonHighlight.y = 77;
- }
-} catch (e) {
- console.log("Settings button highlight error:", e);
-}
-// Create separate settings icon text element
-var settingsIcon = new Text2('⚙', {
- size: 60,
- fill: 0xFFFFFF
-});
-settingsIcon.anchor.set(0.5, 0.5);
-settingsIcon.stroke = 0x6B2C91;
-settingsIcon.strokeThickness = 2;
-try {
- if (LK.gui && LK.gui.topRight) {
- LK.gui.topRight.addChild(settingsIcon);
- settingsIcon.x = -80;
- settingsIcon.y = 80;
- }
-} catch (e) {
- console.log("Settings icon error:", e);
-}
-// Create settings menu overlay (initially hidden)
-var settingsOverlay = LK.getAsset('topPipe', {
- anchorX: 0.5,
- anchorY: 0.5,
- width: 2048,
- height: 2732,
- alpha: 1.0
-});
-settingsOverlay.tint = 0x2F4F4F;
-settingsOverlay.visible = false;
-LK.gui.center.addChild(settingsOverlay);
-var settingsTitle = new Text2('AYARLAR', {
- size: 100,
- fill: 0xFFFFFF
-});
-settingsTitle.anchor.set(0.5, 0.5);
-settingsTitle.stroke = 0x000000;
-settingsTitle.strokeThickness = 5;
-settingsTitle.visible = false;
-LK.gui.center.addChild(settingsTitle);
-settingsTitle.y = -300;
-// Create close settings button with modern rectangular design
-var closeSettingsButton = LK.getAsset('settingsButtonRect', {
- anchorX: 0.5,
- anchorY: 0.5,
- width: 260,
- height: 70,
- alpha: 1.0
-});
-closeSettingsButton.tint = 0x95A5A6;
-closeSettingsButton.visible = false;
-LK.gui.center.addChild(closeSettingsButton);
-closeSettingsButton.y = 150;
-// Add close button shadow for depth
-var closeSettingsButtonShadow = LK.getAsset('settingsButtonRect', {
- anchorX: 0.5,
- anchorY: 0.5,
- width: 260,
- height: 70,
- alpha: 0.3
-});
-closeSettingsButtonShadow.tint = 0x7F8C8D;
-closeSettingsButtonShadow.visible = false;
-LK.gui.center.addChild(closeSettingsButtonShadow);
-closeSettingsButtonShadow.y = 155;
-closeSettingsButtonShadow.x = 3;
-// Add close button highlight
-var closeSettingsButtonHighlight = LK.getAsset('settingsButtonRect', {
- anchorX: 0.5,
- anchorY: 0.5,
- width: 240,
- height: 55,
- alpha: 0.4
-});
-closeSettingsButtonHighlight.tint = 0xBDC3C7;
-closeSettingsButtonHighlight.visible = false;
-LK.gui.center.addChild(closeSettingsButtonHighlight);
-closeSettingsButtonHighlight.y = 145;
-var closeSettingsText = new Text2('KAPAT', {
- size: 36,
- fill: 0xFFFFFF
-});
-closeSettingsText.anchor.set(0.5, 0.5);
-closeSettingsText.stroke = 0x7F8C8D;
-closeSettingsText.strokeThickness = 2;
-closeSettingsText.visible = false;
-LK.gui.center.addChild(closeSettingsText);
-closeSettingsText.y = 150;
-// Create language menu button with modern rectangular design
-var languageMenuButton = LK.getAsset('settingsButtonRect', {
- anchorX: 0.5,
- anchorY: 0.5,
- width: 340,
- height: 75,
- alpha: 1.0
-});
-languageMenuButton.tint = 0x9B59B6;
-languageMenuButton.visible = false;
-LK.gui.center.addChild(languageMenuButton);
-languageMenuButton.y = -85;
-// Add language button shadow for depth
-var languageMenuButtonShadow = LK.getAsset('settingsButtonRect', {
- anchorX: 0.5,
- anchorY: 0.5,
- width: 340,
- height: 75,
- alpha: 0.3
-});
-languageMenuButtonShadow.tint = 0x8E44AD;
-languageMenuButtonShadow.visible = false;
-LK.gui.center.addChild(languageMenuButtonShadow);
-languageMenuButtonShadow.y = -80;
-languageMenuButtonShadow.x = 3;
-// Add language button highlight
-var languageMenuButtonHighlight = LK.getAsset('settingsButtonRect', {
- anchorX: 0.5,
- anchorY: 0.5,
- width: 320,
- height: 60,
- alpha: 0.4
-});
-languageMenuButtonHighlight.tint = 0xBB8FCE;
-languageMenuButtonHighlight.visible = false;
-LK.gui.center.addChild(languageMenuButtonHighlight);
-languageMenuButtonHighlight.y = -85;
-var languageMenuText = new Text2('DİL', {
- size: 42,
- fill: 0xFFFFFF
-});
-languageMenuText.anchor.set(0.5, 0.5);
-languageMenuText.stroke = 0x8E44AD;
-languageMenuText.strokeThickness = 2;
-languageMenuText.visible = false;
-LK.gui.center.addChild(languageMenuText);
-languageMenuText.y = -85;
// Simple background setup
var background = game.addChild(LK.getAsset('background', {
anchorX: 0,
anchorY: 0
@@ -645,15 +459,15 @@
if (playButton) playButton.visible = true;
if (playButtonShadow) playButtonShadow.visible = true;
if (playButtonHighlight) playButtonHighlight.visible = true;
if (playButtonText) playButtonText.visible = true;
- // Show all settings button elements
- settingsButton.visible = true;
- settingsButtonShadow.visible = true;
- settingsButtonHighlight.visible = true;
- settingsIcon.visible = true;
// Show cup shape (high score indicator)
if (cupShape) cupShape.visible = true;
+ // Show main language button elements
+ if (mainLanguageButton) mainLanguageButton.visible = true;
+ if (mainLanguageButtonShadow) mainLanguageButtonShadow.visible = true;
+ if (mainLanguageButtonHighlight) mainLanguageButtonHighlight.visible = true;
+ if (mainLanguageButtonText) mainLanguageButtonText.visible = true;
// Hide instruction
instructionTxt.visible = false;
generateAllPipes();
}
@@ -666,15 +480,15 @@
if (playButton) playButton.visible = false;
if (playButtonShadow) playButtonShadow.visible = false;
if (playButtonHighlight) playButtonHighlight.visible = false;
if (playButtonText) playButtonText.visible = false;
- // Hide all settings button elements
- settingsButton.visible = false;
- settingsButtonShadow.visible = false;
- settingsButtonHighlight.visible = false;
- settingsIcon.visible = false;
// Hide cup shape (high score indicator)
if (cupShape) cupShape.visible = false;
+ // Hide main language button elements
+ if (mainLanguageButton) mainLanguageButton.visible = false;
+ if (mainLanguageButtonShadow) mainLanguageButtonShadow.visible = false;
+ if (mainLanguageButtonHighlight) mainLanguageButtonHighlight.visible = false;
+ if (mainLanguageButtonText) mainLanguageButtonText.visible = false;
// Show instruction
instructionTxt.visible = true;
}
// Function to show game over screen
@@ -917,53 +731,8 @@
languageBackText.strokeThickness = 2;
languageBackText.visible = false;
LK.gui.center.addChild(languageBackText);
languageBackText.y = 150;
-// Function to show settings menu
-function showSettingsMenu() {
- // Hide main menu elements
- mainMenuTitle.visible = false;
- if (playButton) playButton.visible = false;
- if (playButtonShadow) playButtonShadow.visible = false;
- if (playButtonHighlight) playButtonHighlight.visible = false;
- if (playButtonText) playButtonText.visible = false;
- if (cupShape) cupShape.visible = false;
- // Show settings menu elements
- settingsOverlay.visible = true;
- settingsTitle.visible = true;
- closeSettingsButton.visible = true;
- closeSettingsButtonShadow.visible = true;
- closeSettingsButtonHighlight.visible = true;
- closeSettingsText.visible = true;
- languageMenuButton.visible = true;
- languageMenuButtonShadow.visible = true;
- languageMenuButtonHighlight.visible = true;
- languageMenuText.visible = true;
-}
-// Function to hide settings menu
-function hideSettingsMenu() {
- // Hide settings menu elements
- settingsOverlay.visible = false;
- settingsTitle.visible = false;
- closeSettingsButton.visible = false;
- closeSettingsButtonShadow.visible = false;
- closeSettingsButtonHighlight.visible = false;
- closeSettingsText.visible = false;
- languageMenuButton.visible = false;
- languageMenuButtonShadow.visible = false;
- languageMenuButtonHighlight.visible = false;
- languageMenuText.visible = false;
- hideLanguageControls();
- // Show main menu elements only if we're in main menu state
- if (showMainMenu) {
- mainMenuTitle.visible = true;
- if (playButton) playButton.visible = true;
- if (playButtonShadow) playButtonShadow.visible = true;
- if (playButtonHighlight) playButtonHighlight.visible = true;
- if (playButtonText) playButtonText.visible = true;
- if (cupShape) cupShape.visible = true;
- }
-}
// Function to show language controls
function showLanguageControls() {
// Hide main menu elements
mainMenuTitle.visible = false;
@@ -971,24 +740,13 @@
if (playButtonShadow) playButtonShadow.visible = false;
if (playButtonHighlight) playButtonHighlight.visible = false;
if (playButtonText) playButtonText.visible = false;
if (cupShape) cupShape.visible = false;
- // Hide settings button elements
- settingsButton.visible = false;
- settingsButtonShadow.visible = false;
- settingsButtonHighlight.visible = false;
- settingsIcon.visible = false;
- // Hide all settings menu elements
- settingsOverlay.visible = false;
- settingsTitle.visible = false;
- languageMenuButton.visible = false;
- languageMenuButtonShadow.visible = false;
- languageMenuButtonHighlight.visible = false;
- languageMenuText.visible = false;
- closeSettingsButton.visible = false;
- closeSettingsButtonShadow.visible = false;
- closeSettingsButtonHighlight.visible = false;
- closeSettingsText.visible = false;
+ // Hide main language button elements
+ if (mainLanguageButton) mainLanguageButton.visible = false;
+ if (mainLanguageButtonShadow) mainLanguageButtonShadow.visible = false;
+ if (mainLanguageButtonHighlight) mainLanguageButtonHighlight.visible = false;
+ if (mainLanguageButtonText) mainLanguageButtonText.visible = false;
// Show language controls
languageOverlay.visible = true;
languageTitle.visible = true;
turkishButton.visible = true;
@@ -1023,19 +781,21 @@
languageBackButton.visible = false;
languageBackButtonShadow.visible = false;
languageBackButtonHighlight.visible = false;
languageBackText.visible = false;
- // Show settings menu elements again
- settingsOverlay.visible = true;
- settingsTitle.visible = true;
- closeSettingsButton.visible = true;
- closeSettingsButtonShadow.visible = true;
- closeSettingsButtonHighlight.visible = true;
- closeSettingsText.visible = true;
- languageMenuButton.visible = true;
- languageMenuButtonShadow.visible = true;
- languageMenuButtonHighlight.visible = true;
- languageMenuText.visible = true;
+ // Show main menu elements again
+ if (showMainMenu) {
+ mainMenuTitle.visible = true;
+ if (playButton) playButton.visible = true;
+ if (playButtonShadow) playButtonShadow.visible = true;
+ if (playButtonHighlight) playButtonHighlight.visible = true;
+ if (playButtonText) playButtonText.visible = true;
+ if (cupShape) cupShape.visible = true;
+ if (mainLanguageButton) mainLanguageButton.visible = true;
+ if (mainLanguageButtonShadow) mainLanguageButtonShadow.visible = true;
+ if (mainLanguageButtonHighlight) mainLanguageButtonHighlight.visible = true;
+ if (mainLanguageButtonText) mainLanguageButtonText.visible = true;
+ }
}
// Language text objects
var languageTexts = {
tr: {
@@ -1046,10 +806,8 @@
score: 'SKOR',
bestScore: 'EN İYİ',
retry: 'TEKRAR DENE',
mainMenu: 'ANA MENÜ',
- settings: 'AYARLAR',
- close: 'KAPAT',
language: 'DİL',
languageTitle: 'DİL SEÇENEKLERİ',
current: 'MEVCUT',
highestScore: 'EN YÜKSEK',
@@ -1063,10 +821,8 @@
score: 'SCORE',
bestScore: 'BEST',
retry: 'RETRY',
mainMenu: 'MAIN MENU',
- settings: 'SETTINGS',
- close: 'CLOSE',
language: 'LANGUAGE',
languageTitle: 'LANGUAGE OPTIONS',
current: 'CURRENT',
highestScore: 'HIGHEST SCORE',
@@ -1104,23 +860,8 @@
try {
menuButtonText.setText(getText('mainMenu'));
} catch (e) {}
}
- if (settingsTitle && settingsTitle.setText) {
- try {
- settingsTitle.setText(getText('settings'));
- } catch (e) {}
- }
- if (closeSettingsText && closeSettingsText.setText) {
- try {
- closeSettingsText.setText(getText('close'));
- } catch (e) {}
- }
- if (languageMenuText && languageMenuText.setText) {
- try {
- languageMenuText.setText(getText('language'));
- } catch (e) {}
- }
if (languageTitle && languageTitle.setText) {
try {
languageTitle.setText(getText('languageTitle'));
} catch (e) {}
@@ -1129,8 +870,13 @@
try {
languageBackText.setText(getText('back'));
} catch (e) {}
}
+ if (mainLanguageButtonText && mainLanguageButtonText.setText) {
+ try {
+ mainLanguageButtonText.setText(getText('language'));
+ } catch (e) {}
+ }
// Update final and best score texts
if (finalScoreText && finalScoreText.setText) {
var currentScore = LK.getScore();
try {
@@ -1218,8 +964,76 @@
}
} catch (e) {
console.log("Play button error:", e);
}
+// Create language button for direct access from main menu
+var mainLanguageButton = LK.getAsset('playButtonOval', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 300,
+ height: 80,
+ alpha: 1.0
+});
+mainLanguageButton.tint = 0x9B59B6;
+try {
+ if (LK.gui && LK.gui.center) {
+ LK.gui.center.addChild(mainLanguageButton);
+ mainLanguageButton.y = 50;
+ }
+} catch (e) {
+ console.log("Main language button error:", e);
+}
+// Create language button shadow
+var mainLanguageButtonShadow = LK.getAsset('playButtonOval', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 300,
+ height: 80,
+ alpha: 0.3
+});
+mainLanguageButtonShadow.tint = 0x8E44AD;
+try {
+ if (LK.gui && LK.gui.center) {
+ LK.gui.center.addChild(mainLanguageButtonShadow);
+ mainLanguageButtonShadow.y = 55;
+ mainLanguageButtonShadow.x = 3;
+ }
+} catch (e) {
+ console.log("Main language button shadow error:", e);
+}
+// Create language button highlight
+var mainLanguageButtonHighlight = LK.getAsset('playButtonOval', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 280,
+ height: 65,
+ alpha: 0.4
+});
+mainLanguageButtonHighlight.tint = 0xBB8FCE;
+try {
+ if (LK.gui && LK.gui.center) {
+ LK.gui.center.addChild(mainLanguageButtonHighlight);
+ mainLanguageButtonHighlight.y = 45;
+ }
+} catch (e) {
+ console.log("Main language button highlight error:", e);
+}
+// Create language button text
+var mainLanguageButtonText = new Text2('DİL', {
+ size: 36,
+ fill: 0xFFFFFF
+});
+mainLanguageButtonText.anchor.set(0.5, 0.5);
+mainLanguageButtonText.stroke = 0x8E44AD;
+mainLanguageButtonText.strokeThickness = 2;
+try {
+ if (LK.gui && LK.gui.center) {
+ LK.gui.center.addChild(mainLanguageButtonText);
+ mainLanguageButtonText.y = 50;
+ }
+} catch (e) {
+ console.log("Main language button text error:", e);
+}
// Create separate play button shadow element
var playButtonShadow = LK.getAsset('playButtonShadow', {
anchorX: 0.5,
anchorY: 0.5,
@@ -1277,69 +1091,34 @@
// Update language display to show current selection
updateLanguageDisplay();
// Touch/click handler
game.down = function (x, y, obj) {
- // Check settings button click - settings button is positioned at topRight with offset
- var settingsX = 2048 - 80; // topRight.x + settingsButton.x offset
- var settingsY = 80; // topRight.y + settingsButton.y offset
- var settingsSize = 120; // Settings button size
- if (x >= settingsX - settingsSize / 2 && x <= settingsX + settingsSize / 2 && y >= settingsY - settingsSize / 2 && y <= settingsY + settingsSize / 2) {
- // Prevent rapid clicks
- var currentTime;
- try {
- currentTime = Date.now ? Date.now() : new Date().getTime();
- } catch (e) {
- currentTime = 0;
+ // Check if language overlay is visible and handle language controls
+ if (languageOverlay.visible) {
+ // Turkish language button with isolated click area
+ if (turkishButton.visible && x >= 654 && x <= 954 && y >= 1246 && y <= 1326) {
+ var currentTime = Date.now();
+ if (currentTime - lastButtonClickTime < 300) return;
+ lastButtonClickTime = currentTime;
+ // Simple visual feedback with color change
+ simpleColorTint(turkishButton, 0x58D68D, 150);
+ setLanguage('tr');
+ return;
}
- if (currentTime - lastButtonClickTime < 500) {
- return; // Ignore click if too recent
+ // Barrier zone between Turkish and English buttons (x: 954-1094)
+ if (x >= 954 && x <= 1094 && y >= 1246 && y <= 1326) {
+ return; // Block clicks in barrier zone
}
- lastButtonClickTime = currentTime;
- // Simple visual feedback without complex animations
- showSettingsMenu();
- return;
- }
- // Check close settings button if settings menu is open
- if (settingsOverlay.visible) {
- // Language menu section - check language menu button (DIL) with isolated click area
- if (languageMenuButton.visible && !languageOverlay.visible) {
- if (x >= 824 && x <= 1224 && y >= 1200 && y <= 1300) {
- var currentTime = Date.now();
- if (currentTime - lastButtonClickTime < 300) return;
- lastButtonClickTime = currentTime;
- // Simple visual feedback with color change
- simpleColorTint(languageMenuButton, 0xBB8FCE, 150);
- showLanguageControls();
- return;
- }
+ // English language button with isolated click area
+ if (englishButton.visible && x >= 1094 && x <= 1394 && y >= 1246 && y <= 1326) {
+ var currentTime = Date.now();
+ if (currentTime - lastButtonClickTime < 300) return;
+ lastButtonClickTime = currentTime;
+ // Simple visual feedback with color change
+ simpleColorTint(englishButton, 0x85C1E9, 150);
+ setLanguage('en');
+ return;
}
- // Language control buttons with barriers - only when language overlay is visible
- if (languageOverlay.visible) {
- // Turkish language button with isolated click area
- if (turkishButton.visible && x >= 654 && x <= 954 && y >= 1246 && y <= 1326) {
- var currentTime = Date.now();
- if (currentTime - lastButtonClickTime < 300) return;
- lastButtonClickTime = currentTime;
- // Simple visual feedback with color change
- simpleColorTint(turkishButton, 0x58D68D, 150);
- setLanguage('tr');
- return;
- }
- // Barrier zone between Turkish and English buttons (x: 954-1094)
- if (x >= 954 && x <= 1094 && y >= 1246 && y <= 1326) {
- return; // Block clicks in barrier zone
- }
- // English language button with isolated click area
- if (englishButton.visible && x >= 1094 && x <= 1394 && y >= 1246 && y <= 1326) {
- var currentTime = Date.now();
- if (currentTime - lastButtonClickTime < 300) return;
- lastButtonClickTime = currentTime;
- // Simple visual feedback with color change
- simpleColorTint(englishButton, 0x85C1E9, 150);
- setLanguage('en');
- return;
- }
- }
// Check language back button at x = 1024, y = 1516, size 300x100
if (languageBackButton.visible && x >= 874 && x <= 1174 && y >= 1466 && y <= 1566) {
var currentTime = Date.now();
if (currentTime - lastButtonClickTime < 300) return;
@@ -1348,22 +1127,9 @@
simpleColorTint(languageBackButton, 0xABB2B9, 150);
hideLanguageControls();
return;
}
- // Check close settings button (KAPAT) - centered at 1024x1516, button is 300x100
- if (x >= 874 && x <= 1174 && y >= 1400 && y <= 1500) {
- // Prevent rapid clicks
- var currentTime = Date.now();
- if (currentTime - lastButtonClickTime < 300) {
- return; // Ignore click if too recent
- }
- lastButtonClickTime = currentTime;
- // Simple visual feedback with color change
- simpleColorTint(closeSettingsButton, 0xBDC3C7, 150);
- hideSettingsMenu();
- return;
- }
- return; // Don't process other clicks when settings menu is open
+ return; // Don't process other clicks when language overlay is open
}
// Check cup click - cup is positioned at bottomRight with offset
var cupX = 2048 - 100; // bottomRight.x + cupShape.x offset
var cupY = 2732 - 230; // bottomRight.y + cupShape.y offset
@@ -1423,8 +1189,20 @@
simpleColorTint(playButton, 0xFFB74D, 100);
startGameFromMenu();
return;
}
+ // Check main language button click - centered at 1024x1416 (center.y = 1366 + mainLanguageButton.y = 50), button is 300x80
+ if (mainLanguageButton && mainLanguageButton.visible && x >= 874 && x <= 1174 && y >= 1376 && y <= 1456) {
+ var currentTime = Date.now();
+ if (currentTime - lastButtonClickTime < 300) {
+ return; // Ignore click if too recent
+ }
+ lastButtonClickTime = currentTime;
+ // Simple visual feedback with color change
+ simpleColorTint(mainLanguageButton, 0xBB8FCE, 150);
+ showLanguageControls();
+ return;
+ }
return;
}
if (!gameStarted) {
gameStarted = true;