User prompt
oyundaki hiç birşey değiştirme ama tüm hataları düzelt
User prompt
en iyi skoru gösteren tabelanın hatalarını düzelt en yüksek yaptığımız skoru her zaman göstersin ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Oyunun açılmasıyla ilgili hataları düzelt
User prompt
kuşun hızıyla ilgili hataları düzelt
User prompt
oyun başladığında ayarlar kısmıyla yüksek skor kısmı gözükmesin
User prompt
en iyi skoru kaydetmesiyle ilgili bir hata var kaydetmiyor
User prompt
hız seçenekleri sırayla normal 1.5x 1.5x ve 2x
User prompt
ayarlara tıklayınca hız diye bir seçenek olsun ona tıklayınca hız ayarlama kısmı çıksın ortaya
User prompt
3x olmak yerine seçenekler normal 1x, 2x, 1.5x gibi
User prompt
ayarlara tıklayınca hız ayarlama logosu çıksın oradan istediğimiz hızı seçelim normal, 2x ve 3x gibi seçenek olsun
User prompt
AYARLAR LOGOSUNUN BOYUTUNU BÜYÜT
User prompt
sağ üst köşeye ayarlar kısmına ekle
User prompt
şu an hiç bir işe yaramayan kodları sil fazladan olanları oyunu bozma
User prompt
Bazı cihazlarda oyunun açılmaması ile ilgili hatalar var. Düzelt.
User prompt
Oyunun Daha İyi Çalışması İçin Daha Önce Kullandığın Fakat Şu An Kullanmadığın Kodları Sil İşine Yaramayan
User prompt
Oyun bittiği yazısını beyaz yap
User prompt
Oyunu bozmadan hata veren her şeyi düzelt.
User prompt
Yanlış anladın oyuncu tekrar denetüşüne basarsa oyun direk başlamıyor tıkla ve oyna menüsü var ya oraya yönlendiriliyor
User prompt
oyuncu eğer tekrar da net ucuna basarsa direkt tıkla ve oyuna kısmına yönlendirmeliyiz
User prompt
Oynayan Kişi Yenildiğinde Tekrar Oynayın Tuşu Tekrar Deneyin Tuşu Gibi Birşey Olsun
User prompt
Duvarın üstüne koyduğun daha güzel dursun diye koyduğun şeyleri daha güzel görsellerle değiştir.
User prompt
Duvarda oluşan hataları düzelt ama bozma.
User prompt
Duvarların görünümünü iyileştir. Daha iyi olsun.
User prompt
Duvar ile kuşun hatasını düzelt.
User prompt
butonlara çok hızlı tıklayınca oyundan atıyor
/**** * Classes ****/ var Bird = Container.expand(function () { var self = Container.call(this); var birdGraphics = self.attachAsset('bird', { anchorX: 0.5, anchorY: 0.5 }); self.velocity = 0; self.gravity = baseGravity * gameSpeed; self.jumpStrength = baseJumpStrength * gameSpeed; self.flap = function () { self.velocity = baseJumpStrength * gameSpeed; try { LK.getSound('flap').play(); } catch (e) { console.log("Flap sound error:", e); } }; self.update = function () { if (!gameStarted) { // Don't apply physics before game starts - keep bird completely still self.velocity = 0; self.y = 1366; // Keep bird at starting position birdGraphics.rotation = 0; // Keep bird level return; } // Update dynamic values based on current game speed self.gravity = baseGravity * gameSpeed; self.jumpStrength = baseJumpStrength * gameSpeed; self.velocity += self.gravity; self.y += self.velocity; // Rotate bird based on velocity birdGraphics.rotation = Math.max(-0.5, Math.min(1.5, self.velocity * 0.1)); // Limit bird movement to screen bounds with proper collision detection var birdRadius = 40; // Half of bird height for collision detection if (self.y - birdRadius < 0) { self.y = birdRadius; self.velocity = 0; } if (self.y + birdRadius > 2732 - 150) { self.y = 2732 - 150 - birdRadius; self.velocity = 0; } }; return self; }); var Pipe = Container.expand(function (gapCenterY) { var self = Container.call(this); self.gapSize = 600; self.speed = basePipeSpeed * gameSpeed; self.passed = false; self.gapCenterY = gapCenterY; // Store pipe width for consistent collision detection self.pipeWidth = 120; // Create top pipe body var topPipe = self.attachAsset('topPipe', { anchorX: 0.5, anchorY: 1 }); topPipe.y = gapCenterY - self.gapSize / 2; // Set reasonable height for top pipe (minimum 200px, maximum based on gap position) var topPipeHeight = Math.max(200, gapCenterY - self.gapSize / 2); topPipe.height = topPipeHeight; topPipe.width = self.pipeWidth; // Create enhanced top pipe highlight with metallic shine var topPipeHighlight = self.attachAsset('pipeHighlight', { anchorX: 0.5, anchorY: 1 }); topPipeHighlight.y = gapCenterY - self.gapSize / 2; topPipeHighlight.height = topPipeHeight; topPipeHighlight.width = 35; topPipeHighlight.x = -30; topPipeHighlight.tint = 0xE6E6FA; // Lavender metallic shine // Add secondary highlight for depth var topPipeShine = self.attachAsset('pipeHighlight', { anchorX: 0.5, anchorY: 1 }); topPipeShine.y = gapCenterY - self.gapSize / 2; topPipeShine.height = topPipeHeight; topPipeShine.width = 15; topPipeShine.x = -35; topPipeShine.tint = 0xF5F5F5; // Bright metallic shine topPipeShine.alpha = 0.8; // Create decorative top pipe cap with metallic rim var topPipeCap = self.attachAsset('pipeTop', { anchorX: 0.5, anchorY: 1 }); topPipeCap.y = gapCenterY - self.gapSize / 2; topPipeCap.width = self.pipeWidth + 30; // More prominent cap topPipeCap.tint = 0x4169E1; // Royal blue metallic color // Add metallic rim effect on top cap var topCapRim = self.attachAsset('pipeTop', { anchorX: 0.5, anchorY: 1 }); topCapRim.y = gapCenterY - self.gapSize / 2; topCapRim.width = self.pipeWidth + 40; topCapRim.height = 25; topCapRim.tint = 0x708090; // Slate gray metallic rim // Add golden accent stripe var topCapAccent = self.attachAsset('pipeTop', { anchorX: 0.5, anchorY: 1 }); topCapAccent.y = gapCenterY - self.gapSize / 2 + 15; topCapAccent.width = self.pipeWidth + 25; topCapAccent.height = 15; topCapAccent.tint = 0xFFD700; // Gold accent // Create bottom pipe body var bottomPipe = self.attachAsset('bottomPipe', { anchorX: 0.5, anchorY: 0 }); bottomPipe.y = gapCenterY + self.gapSize / 2; // Set reasonable height for bottom pipe (minimum 200px, maximum based on available space) var bottomPipeHeight = Math.max(200, 2732 - 150 - (gapCenterY + self.gapSize / 2)); bottomPipe.height = bottomPipeHeight; bottomPipe.width = self.pipeWidth; // Create enhanced bottom pipe highlight with metallic shine var bottomPipeHighlight = self.attachAsset('pipeHighlight', { anchorX: 0.5, anchorY: 0 }); bottomPipeHighlight.y = gapCenterY + self.gapSize / 2; bottomPipeHighlight.height = bottomPipeHeight; bottomPipeHighlight.width = 35; bottomPipeHighlight.x = -30; bottomPipeHighlight.tint = 0xE6E6FA; // Lavender metallic shine // Add secondary highlight for depth var bottomPipeShine = self.attachAsset('pipeHighlight', { anchorX: 0.5, anchorY: 0 }); bottomPipeShine.y = gapCenterY + self.gapSize / 2; bottomPipeShine.height = bottomPipeHeight; bottomPipeShine.width = 15; bottomPipeShine.x = -35; bottomPipeShine.tint = 0xF5F5F5; // Bright metallic shine bottomPipeShine.alpha = 0.8; // Create decorative bottom pipe cap with metallic rim var bottomPipeCap = self.attachAsset('pipeBottom', { anchorX: 0.5, anchorY: 0 }); bottomPipeCap.y = gapCenterY + self.gapSize / 2; bottomPipeCap.width = self.pipeWidth + 30; // More prominent cap bottomPipeCap.tint = 0x4169E1; // Royal blue metallic color // Add metallic rim effect on bottom cap var bottomCapRim = self.attachAsset('pipeBottom', { anchorX: 0.5, anchorY: 0 }); bottomCapRim.y = gapCenterY + self.gapSize / 2; bottomCapRim.width = self.pipeWidth + 40; bottomCapRim.height = 25; bottomCapRim.tint = 0x708090; // Slate gray metallic rim // Add golden accent stripe var bottomCapAccent = self.attachAsset('pipeBottom', { anchorX: 0.5, anchorY: 0 }); bottomCapAccent.y = gapCenterY + self.gapSize / 2 - 15; bottomCapAccent.width = self.pipeWidth + 25; bottomCapAccent.height = 15; bottomCapAccent.tint = 0xFFD700; // Gold accent self.update = function () { if (!gameStarted) { // Don't move pipes before game starts return; } // Update dynamic speed based on current game speed self.speed = basePipeSpeed * gameSpeed; self.x += self.speed; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game(); /**** * Game Code ****/ // Game variables try {} catch (e) { console.log("Asset initialization error:", e); } var tween; var storage; try { tween = LK.import("@upit/tween.v1"); storage = LK.import("@upit/storage.v1"); } catch (e) { console.log("Plugin import error:", e); // Provide fallback objects to prevent undefined errors tween = function tween() { return { duration: 0, onFinish: function onFinish() {} }; }; storage = {}; } var bird; var pipes = []; var ground; var topBarrier; var bottomBarrier; var gameStarted = false; var gameOver = false; var showMainMenu = true; var showGameOver = false; var pipeSpacing = 500; // Increased spacing between pipes to make them further apart var buttonClickTimeout = null; // Prevent rapid button clicks var lastButtonClickTime = 0; // Track last button click time var gameSpeed = 1; // Current game speed multiplier (1 = normal, 2 = 2x, 3 = 3x) var baseGravity = 0.8; // Base gravity for bird var baseJumpStrength = -12; // Base jump strength for bird var basePipeSpeed = -3; // Base pipe movement speed // 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; 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: 100, 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 = -200; } } catch (e) { console.log("Main menu title error:", e); } // Create play button with oval shape var playButton = LK.getAsset('playButtonOval', { anchorX: 0.5, anchorY: 0.5, width: 300, height: 100, alpha: 0.9 }); playButton.tint = 0xFF4500; LK.gui.center.addChild(playButton); playButton.y = 50; var playButtonText = new Text2('OYNA', { size: 50, fill: 0xFFFFFF }); playButtonText.anchor.set(0.5, 0.5); playButtonText.stroke = 0x000000; playButtonText.strokeThickness = 3; LK.gui.center.addChild(playButtonText); playButtonText.y = 50; // Create instruction text var instructionTxt = new Text2('TIKLA VE OYNA!', { size: 60, fill: 0xFFFFFF }); instructionTxt.anchor.set(0.5, 0.5); instructionTxt.stroke = 0x000000; instructionTxt.strokeThickness = 3; instructionTxt.visible = false; // Add background shape for instruction text var instructionBg = LK.getAsset('barrier', { anchorX: 0.5, anchorY: 0.5, width: 400, height: 100, alpha: 0.8 }); instructionBg.tint = 0x8B0000; instructionBg.visible = false; LK.gui.center.addChild(instructionBg); LK.gui.center.addChild(instructionTxt); // Create game over screen elements var gameOverBg = LK.getAsset('barrier', { 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 var retryButton = LK.getAsset('playButtonOval', { anchorX: 0.5, anchorY: 0.5, width: 400, height: 120, alpha: 0.9 }); retryButton.tint = 0x32CD32; retryButton.visible = false; LK.gui.center.addChild(retryButton); retryButton.y = 100; var retryButtonText = new Text2('TEKRAR DENE', { size: 50, fill: 0xFFFFFF }); retryButtonText.anchor.set(0.5, 0.5); retryButtonText.stroke = 0x000000; retryButtonText.strokeThickness = 3; retryButtonText.visible = false; LK.gui.center.addChild(retryButtonText); retryButtonText.y = 100; // Create menu button var menuButton = LK.getAsset('playButtonOval', { anchorX: 0.5, anchorY: 0.5, width: 400, height: 120, alpha: 0.9 }); menuButton.tint = 0xFF4500; menuButton.visible = false; LK.gui.center.addChild(menuButton); menuButton.y = 250; var menuButtonText = new Text2('ANA MENÜ', { size: 50, fill: 0xFFFFFF }); menuButtonText.anchor.set(0.5, 0.5); menuButtonText.stroke = 0x000000; menuButtonText.strokeThickness = 3; menuButtonText.visible = false; LK.gui.center.addChild(menuButtonText); menuButtonText.y = 250; // Create settings button for top right corner var settingsButton = LK.getAsset('playButtonOval', { anchorX: 0.5, anchorY: 0.5, width: 120, height: 120, alpha: 0.9 }); settingsButton.tint = 0x4169E1; 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 settings icon text (gear symbol) var settingsIcon = new Text2('⚙', { size: 60, fill: 0xFFFFFF }); settingsIcon.anchor.set(0.5, 0.5); 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('barrier', { anchorX: 0.5, anchorY: 0.5, width: 1600, height: 1200, alpha: 0.95 }); 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 var closeSettingsButton = LK.getAsset('playButtonOval', { anchorX: 0.5, anchorY: 0.5, width: 300, height: 100, alpha: 0.9 }); closeSettingsButton.tint = 0xFF4500; closeSettingsButton.visible = false; LK.gui.center.addChild(closeSettingsButton); closeSettingsButton.y = 200; var closeSettingsText = new Text2('KAPAT', { size: 50, fill: 0xFFFFFF }); closeSettingsText.anchor.set(0.5, 0.5); closeSettingsText.stroke = 0x000000; closeSettingsText.strokeThickness = 3; closeSettingsText.visible = false; LK.gui.center.addChild(closeSettingsText); closeSettingsText.y = 200; // Create speed menu button var speedMenuButton = LK.getAsset('playButtonOval', { anchorX: 0.5, anchorY: 0.5, width: 400, height: 100, alpha: 0.9 }); speedMenuButton.tint = 0x4169E1; speedMenuButton.visible = false; LK.gui.center.addChild(speedMenuButton); speedMenuButton.y = -100; var speedMenuText = new Text2('HIZ', { size: 60, fill: 0xFFFFFF }); speedMenuText.anchor.set(0.5, 0.5); speedMenuText.stroke = 0x000000; speedMenuText.strokeThickness = 3; speedMenuText.visible = false; LK.gui.center.addChild(speedMenuText); speedMenuText.y = -100; // Create speed control title var speedTitle = new Text2('HIZ AYARI', { size: 80, fill: 0xFFFFFF }); speedTitle.anchor.set(0.5, 0.5); speedTitle.stroke = 0x000000; speedTitle.strokeThickness = 4; speedTitle.visible = false; LK.gui.center.addChild(speedTitle); speedTitle.y = -150; // Create speed option buttons var normalSpeedButton = LK.getAsset('playButtonOval', { anchorX: 0.5, anchorY: 0.5, width: 200, height: 80, alpha: 0.9 }); normalSpeedButton.tint = 0x32CD32; normalSpeedButton.visible = false; LK.gui.center.addChild(normalSpeedButton); normalSpeedButton.y = -50; normalSpeedButton.x = -250; var normalSpeedText = new Text2('NORMAL', { size: 40, fill: 0xFFFFFF }); normalSpeedText.anchor.set(0.5, 0.5); normalSpeedText.stroke = 0x000000; normalSpeedText.strokeThickness = 2; normalSpeedText.visible = false; LK.gui.center.addChild(normalSpeedText); normalSpeedText.y = -50; normalSpeedText.x = -250; var speed15xButton = LK.getAsset('playButtonOval', { anchorX: 0.5, anchorY: 0.5, width: 200, height: 80, alpha: 0.9 }); speed15xButton.tint = 0xFF4500; speed15xButton.visible = false; LK.gui.center.addChild(speed15xButton); speed15xButton.y = -50; speed15xButton.x = 0; var speed15xText = new Text2('1.5X', { size: 40, fill: 0xFFFFFF }); speed15xText.anchor.set(0.5, 0.5); speed15xText.stroke = 0x000000; speed15xText.strokeThickness = 2; speed15xText.visible = false; LK.gui.center.addChild(speed15xText); speed15xText.y = -50; speed15xText.x = 0; var speed2xButton = LK.getAsset('playButtonOval', { anchorX: 0.5, anchorY: 0.5, width: 200, height: 80, alpha: 0.9 }); speed2xButton.tint = 0xFF8C00; speed2xButton.visible = false; LK.gui.center.addChild(speed2xButton); speed2xButton.y = -50; speed2xButton.x = 250; var speed2xText = new Text2('2X', { size: 40, fill: 0xFFFFFF }); speed2xText.anchor.set(0.5, 0.5); speed2xText.stroke = 0x000000; speed2xText.strokeThickness = 2; speed2xText.visible = false; LK.gui.center.addChild(speed2xText); speed2xText.y = -50; speed2xText.x = 250; // Current speed indicator var currentSpeedText = new Text2('MEVCUT: NORMAL', { size: 50, fill: 0xFFD700 }); currentSpeedText.anchor.set(0.5, 0.5); currentSpeedText.stroke = 0x000000; currentSpeedText.strokeThickness = 3; currentSpeedText.visible = false; LK.gui.center.addChild(currentSpeedText); currentSpeedText.y = 50; // Create invisible barrier blocks to constrain bird before game starts var topBarrier = game.addChild(LK.getAsset('barrier', { anchorX: 0.5, anchorY: 1 })); topBarrier.x = 400; topBarrier.y = 1316; // 50 pixels above bird topBarrier.alpha = 0; // Make invisible var bottomBarrier = game.addChild(LK.getAsset('barrier', { anchorX: 0.5, anchorY: 0 })); bottomBarrier.x = 400; bottomBarrier.y = 1416; // 50 pixels below bird bottomBarrier.alpha = 0; // Make invisible // Create and add background image (appears behind barriers but in front of other elements) var background = game.addChild(LK.getAsset('background', { anchorX: 0, anchorY: 0 })); background.x = 0; background.y = 0; // Scale background to fill screen for better performance 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 bird = game.addChild(new Bird()); bird.x = 400; bird.y = 1366; // Create pipe function function createPipe() { // Define safe boundaries for gap center to ensure both pipes have reasonable heights var minGapY = 800; // Minimum gap center position (ensures top pipe has decent height) var maxGapY = 1800; // Maximum gap center position (ensures bottom pipe has decent height) var gapCenterY = minGapY + Math.random() * (maxGapY - minGapY); var pipe = new Pipe(gapCenterY); // Calculate position based on last pipe position + consistent spacing if (pipes.length === 0) { pipe.x = 2048 + 100; // First pipe position - brought closer } else { pipe.x = pipes[pipes.length - 1].x + pipeSpacing; // Consistent spacing from last pipe } ; pipes.push(pipe); game.addChild(pipe); } // Reset game function function resetGame() { // Reset bird bird.x = 400; 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; playButton.visible = true; playButtonText.visible = true; // Show settings button and icon settingsButton.visible = true; settingsIcon.visible = true; // Show cup shape (high score indicator) if (cupShape) cupShape.visible = true; // Hide instruction instructionTxt.visible = false; instructionBg.visible = false; // Clear existing barriers if they exist if (topBarrier) { topBarrier.destroy(); topBarrier = null; } if (bottomBarrier) { bottomBarrier.destroy(); bottomBarrier = null; } // Recreate invisible barriers topBarrier = game.addChild(LK.getAsset('barrier', { anchorX: 0.5, anchorY: 1 })); topBarrier.x = 400; topBarrier.y = 1316; // 50 pixels above bird topBarrier.alpha = 0; // Make invisible bottomBarrier = game.addChild(LK.getAsset('barrier', { anchorX: 0.5, anchorY: 0 })); bottomBarrier.x = 400; bottomBarrier.y = 1416; // 50 pixels below bird bottomBarrier.alpha = 0; // Make invisible // Create initial pipes createPipe(); createPipe(); } // Function to start game from main menu function startGameFromMenu() { showMainMenu = false; // Hide main menu elements mainMenuTitle.visible = false; playButton.visible = false; playButtonText.visible = false; // Hide settings button and icon settingsButton.visible = false; settingsIcon.visible = false; // Hide cup shape (high score indicator) if (cupShape) cupShape.visible = false; // Show instruction instructionTxt.visible = true; instructionBg.visible = true; } // Function to show game over screen function showGameOverScreen(finalScore) { showGameOver = true; gameStarted = false; showMainMenu = false; // Hide instruction instructionTxt.visible = false; instructionBg.visible = false; // Show game over elements gameOverBg.visible = true; gameOverTitle.visible = true; finalScoreText.visible = true; bestScoreText.visible = true; retryButton.visible = true; retryButtonText.visible = true; menuButton.visible = true; menuButtonText.visible = true; // Update score displays finalScoreText.setText('SKOR: ' + finalScore); bestScoreText.setText('EN İYİ: ' + (_storage.highScore || 0)); } // 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; menuButton.visible = false; menuButtonText.visible = false; } // Function to show settings menu function showSettingsMenu() { settingsOverlay.visible = true; settingsTitle.visible = true; closeSettingsButton.visible = true; closeSettingsText.visible = true; speedMenuButton.visible = true; speedMenuText.visible = true; } // Function to hide settings menu function hideSettingsMenu() { settingsOverlay.visible = false; settingsTitle.visible = false; closeSettingsButton.visible = false; closeSettingsText.visible = false; speedMenuButton.visible = false; speedMenuText.visible = false; hideSpeedControls(); } // Function to show speed controls function showSpeedControls() { speedMenuButton.visible = false; speedMenuText.visible = false; speedTitle.visible = true; normalSpeedButton.visible = true; normalSpeedText.visible = true; speed2xButton.visible = true; speed2xText.visible = true; speed15xButton.visible = true; speed15xText.visible = true; currentSpeedText.visible = true; updateSpeedDisplay(); } // Function to hide speed controls function hideSpeedControls() { speedTitle.visible = false; normalSpeedButton.visible = false; normalSpeedText.visible = false; speed2xButton.visible = false; speed2xText.visible = false; speed15xButton.visible = false; speed15xText.visible = false; currentSpeedText.visible = false; } // Function to update speed display function updateSpeedDisplay() { var speedText = 'NORMAL'; if (gameSpeed === 2) speedText = '2X';else if (gameSpeed === 1.5) speedText = '1.5X'; currentSpeedText.setText('MEVCUT: ' + speedText); // Update button colors to show selected speed normalSpeedButton.tint = gameSpeed === 1 ? 0x00FF00 : 0x32CD32; speed2xButton.tint = gameSpeed === 2 ? 0x00FF00 : 0xFF8C00; speed15xButton.tint = gameSpeed === 1.5 ? 0x00FF00 : 0xFF4500; } // Function to set game speed function setGameSpeed(newSpeed) { gameSpeed = newSpeed; updateSpeedDisplay(); // Update existing pipes if they exist for (var i = 0; i < pipes.length; i++) { if (pipes[i]) { pipes[i].speed = basePipeSpeed * gameSpeed; } } } // Initialize local storage arrays if they don't exist try { if (!_storage) _storage = {}; if (!_storage.globalLeaderboardNames) _storage.globalLeaderboardNames = []; if (!_storage.globalLeaderboardScores) _storage.globalLeaderboardScores = []; if (!_storage.highScore) _storage.highScore = 0; if (!_storage.lastScore) _storage.lastScore = 0; // Load high score from persistent storage try { if (storage && storage.getItem) { var savedHighScore = storage.getItem('highScore'); if (savedHighScore && savedHighScore > _storage.highScore) { _storage.highScore = savedHighScore; } } } catch (e) { console.log("Storage load error:", e); } } catch (e) { console.log("Storage initialization error:", e); _storage = { globalLeaderboardNames: [], globalLeaderboardScores: [], highScore: 0, lastScore: 0 }; } // Initialize username if not exists if (!_storage.username) { var playerNumber = 1; while (_storage.globalLeaderboardNames.indexOf('Oyuncu ' + playerNumber) !== -1) { playerNumber++; } _storage.username = 'Oyuncu ' + playerNumber; } // Initialize game createPipe(); createPipe(); // 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; } if (currentTime - lastButtonClickTime < 500) { return; // Ignore click if too recent } lastButtonClickTime = currentTime; // Add visual feedback with tween tween(settingsButton, { scaleX: 1.2, scaleY: 1.2 }, { duration: 100, onFinish: function onFinish() { tween(settingsButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100 }); } }); showSettingsMenu(); return; } // Check close settings button if settings menu is open if (settingsOverlay.visible) { // Check speed menu button (HIZ) - centered at 1024x1266, button is 400x100 if (speedMenuButton.visible && x >= 824 && x <= 1224 && y >= 1216 && y <= 1316) { var currentTime = Date.now(); if (currentTime - lastButtonClickTime < 300) return; lastButtonClickTime = currentTime; tween(speedMenuButton, { scaleX: 1.1, scaleY: 1.1 }, { duration: 100, onFinish: function onFinish() { tween(speedMenuButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100 }); } }); showSpeedControls(); return; } // Check speed buttons - Normal button at x = 1024-250 = 774, y = 1366-50 = 1316, size 200x80 if (x >= 674 && x <= 874 && y >= 1276 && y <= 1356) { var currentTime = Date.now(); if (currentTime - lastButtonClickTime < 300) return; lastButtonClickTime = currentTime; tween(normalSpeedButton, { scaleX: 1.1, scaleY: 1.1 }, { duration: 100, onFinish: function onFinish() { tween(normalSpeedButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100 }); } }); setGameSpeed(1); return; } // Check 1.5X speed button at x = 1024, y = 1316, size 200x80 if (x >= 924 && x <= 1124 && y >= 1276 && y <= 1356) { var currentTime = Date.now(); if (currentTime - lastButtonClickTime < 300) return; lastButtonClickTime = currentTime; tween(speed15xButton, { scaleX: 1.1, scaleY: 1.1 }, { duration: 100, onFinish: function onFinish() { tween(speed15xButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100 }); } }); setGameSpeed(1.5); return; } // Check 2X speed button at x = 1024+250 = 1274, y = 1316, size 200x80 if (x >= 1174 && x <= 1374 && y >= 1276 && y <= 1356) { var currentTime = Date.now(); if (currentTime - lastButtonClickTime < 300) return; lastButtonClickTime = currentTime; tween(speed2xButton, { scaleX: 1.1, scaleY: 1.1 }, { duration: 100, onFinish: function onFinish() { tween(speed2xButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100 }); } }); setGameSpeed(2); return; } // Check close settings button (KAPAT) - centered at 1024x1516, button is 300x100 if (x >= 874 && x <= 1174 && y >= 1466 && y <= 1566) { // Prevent rapid clicks var currentTime = Date.now(); if (currentTime - lastButtonClickTime < 300) { return; // Ignore click if too recent } lastButtonClickTime = currentTime; // Add visual feedback with tween tween(closeSettingsButton, { scaleX: 1.1, scaleY: 1.1 }, { duration: 100, onFinish: function onFinish() { tween(closeSettingsButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100 }); } }); hideSettingsMenu(); return; } return; // Don't process other clicks when settings menu 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) { // Prevent rapid clicks var currentTime; try { currentTime = Date.now ? Date.now() : new Date().getTime(); } catch (e) { currentTime = 0; } if (currentTime - lastButtonClickTime < 500) { return; // Ignore click if too recent } lastButtonClickTime = currentTime; // Clear any existing high score displays first var existingDisplays = LK.gui.center.children; for (var k = existingDisplays.length - 1; k >= 0; k--) { var child = existingDisplays[k]; if (child && child.getText && child.getText().indexOf('EN YÜKSEK:') !== -1) { try { child.destroy(); } catch (e) { console.log("Error destroying high score display:", e); } } } // Clear any existing backgrounds for (var k = existingDisplays.length - 1; k >= 0; k--) { var child = existingDisplays[k]; if (child && child.tint === 0x000000 && child.width === 700) { try { child.destroy(); } catch (e) { console.log("Error destroying background:", e); } } } // Show highest score in a temporary display using storage var highScore = _storage && _storage.highScore || 0; var highScoreDisplay = new Text2('EN YÜKSEK: ' + highScore, { size: 90, fill: 0xFFFF00 }); highScoreDisplay.anchor.set(0.5, 0.5); highScoreDisplay.stroke = 0x000000; highScoreDisplay.strokeThickness = 4; LK.gui.center.addChild(highScoreDisplay); highScoreDisplay.y = -100; // Add background for better visibility var highScoreBg = LK.getAsset('barrier', { anchorX: 0.5, anchorY: 0.5, width: 700, height: 160, alpha: 0.98 }); highScoreBg.tint = 0x000000; LK.gui.center.addChild(highScoreBg); highScoreBg.y = -100; // Move background behind text LK.gui.center.removeChild(highScoreBg); LK.gui.center.addChildAt(highScoreBg, LK.gui.center.getChildIndex(highScoreDisplay)); // Auto-hide after 3 seconds LK.setTimeout(function () { try { if (highScoreDisplay && highScoreDisplay.parent) { highScoreDisplay.destroy(); } if (highScoreBg && highScoreBg.parent) { highScoreBg.destroy(); } } catch (e) { console.log("Error in timeout cleanup:", e); } }, 3000); return; } if (gameOver || showGameOver) { // Check retry button (TEKRAR DENE) - centered at 1024x1466, button is 400x120 if (x >= 824 && x <= 1224 && y >= 1406 && y <= 1526) { // Prevent rapid clicks var currentTime = Date.now(); if (currentTime - lastButtonClickTime < 300) { return; // Ignore click if too recent } lastButtonClickTime = currentTime; // Add visual feedback with tween tween(retryButton, { scaleX: 1.1, scaleY: 1.1 }, { duration: 100, onFinish: function onFinish() { tween(retryButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100 }); } }); hideGameOverScreen(); resetGame(); // Show instruction screen instead of starting game directly startGameFromMenu(); return; } // Check menu button (ANA MENÜ) - centered at 1024x1616, button is 400x120 if (x >= 824 && x <= 1224 && y >= 1556 && y <= 1676) { // Prevent rapid clicks var currentTime = Date.now(); if (currentTime - lastButtonClickTime < 300) { return; // Ignore click if too recent } lastButtonClickTime = currentTime; // Add visual feedback with tween tween(menuButton, { scaleX: 1.1, scaleY: 1.1 }, { duration: 100, onFinish: function onFinish() { tween(menuButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100 }); } }); hideGameOverScreen(); resetGame(); return; } return; } if (showMainMenu) { // Check play button (OYNA) - centered at 1024x1366, button is 300x80 if (x >= 874 && x <= 1174 && y >= 1326 && y <= 1406) { // Prevent rapid clicks var currentTime = Date.now(); if (currentTime - lastButtonClickTime < 300) { return; // Ignore click if too recent } lastButtonClickTime = currentTime; // Clear any existing timeout if (buttonClickTimeout) { LK.clearTimeout(buttonClickTimeout); buttonClickTimeout = null; } // Add visual feedback with tween tween(playButton, { scaleX: 1.1, scaleY: 1.1 }, { duration: 100, onFinish: function onFinish() { tween(playButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100 }); } }); // Add small delay to prevent double clicks buttonClickTimeout = LK.setTimeout(function () { buttonClickTimeout = null; startGameFromMenu(); }, 150); return; } return; } if (!gameStarted) { gameStarted = true; instructionTxt.visible = false; instructionBg.visible = false; // Remove invisible barriers when game starts if (topBarrier) { topBarrier.destroy(); topBarrier = null; } if (bottomBarrier) { bottomBarrier.destroy(); bottomBarrier = null; } } 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(); _storage.lastScore = currentScore; if (currentScore > (_storage.highScore || 0)) { _storage.highScore = currentScore; // Save high score to persistent storage try { if (storage && storage.setItem) { storage.setItem('highScore', currentScore); } } catch (e) { console.log("Storage save error:", e); } } // Add to leaderboard if score > 0 if (currentScore > 0 && _storage) { var currentUsername = _storage.username || 'Oyuncu'; var playerExists = false; var leaderboardNames = _storage.globalLeaderboardNames || []; for (var i = 0; i < leaderboardNames.length; i++) { if (_storage.globalLeaderboardNames[i] === currentUsername) { if (currentScore > _storage.globalLeaderboardScores[i]) { _storage.globalLeaderboardScores[i] = currentScore; } playerExists = true; break; } } if (!playerExists) { _storage.globalLeaderboardNames.push(currentUsername); _storage.globalLeaderboardScores.push(currentScore); } } showGameOverScreen(currentScore); return; } // Check pipe collisions and scoring for (var i = 0; i < pipes.length; i++) { var pipe = pipes[i]; if (!pipe || !bird || pipe.destroyed) continue; // Check scoring first - only for pipes that haven't been passed yet if (!pipe.passed && pipe.x + 50 < bird.x) { pipe.passed = true; LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore().toString()); try { LK.getSound('score').play(); } catch (e) { console.log("Sound error:", e); } } // Only check collision for pipes that are close to the bird if (Math.abs(pipe.x - bird.x) < 150) { // Check if bird is within pipe horizontally using actual pipe width var pipeHalfWidth = (pipe.pipeWidth || 120) / 2; if (bird.x + 40 > pipe.x - pipeHalfWidth && bird.x - 40 < pipe.x + pipeHalfWidth) { // Check collision with top or bottom pipe - bird is 80px tall, so use 40px radius var birdTop = bird.y - 40; var birdBottom = bird.y + 40; var gapTop = pipe.gapCenterY - pipe.gapSize / 2; var gapBottom = pipe.gapCenterY + pipe.gapSize / 2; // Collision occurs if bird overlaps with pipe (outside the gap) if (birdTop < gapTop || birdBottom > gapBottom) { gameOver = true; var currentScore = LK.getScore(); _storage.lastScore = currentScore; if (currentScore > (_storage.highScore || 0)) { _storage.highScore = currentScore; // Save high score to persistent storage try { if (storage && storage.setItem) { storage.setItem('highScore', currentScore); } } catch (e) { console.log("Storage save error:", e); } } // Add to leaderboard if score > 0 if (currentScore > 0) { var currentUsername = _storage.username; var playerExists = false; for (var j = 0; j < _storage.globalLeaderboardNames.length; j++) { if (_storage.globalLeaderboardNames[j] === currentUsername) { if (currentScore > _storage.globalLeaderboardScores[j]) { _storage.globalLeaderboardScores[j] = currentScore; } playerExists = true; break; } } if (!playerExists) { _storage.globalLeaderboardNames.push(currentUsername); _storage.globalLeaderboardScores.push(currentScore); } } showGameOverScreen(currentScore); return; } } } } // Create new pipes - maintain consistent spacing if (pipes.length === 0 || pipes.length > 0 && pipes[pipes.length - 1].x <= 2048 + 100 - pipeSpacing) { createPipe(); } // Remove off-screen pipes periodically using frame counter if (!game.frameCounter) game.frameCounter = 0; game.frameCounter++; if (game.frameCounter % 30 === 0) { for (var j = pipes.length - 1; j >= 0; j--) { if (pipes[j].x < -150) { pipes[j].destroy(); pipes.splice(j, 1); } } } } };
===================================================================
--- original.js
+++ change.js
@@ -10,9 +10,9 @@
self.velocity = 0;
self.gravity = baseGravity * gameSpeed;
self.jumpStrength = baseJumpStrength * gameSpeed;
self.flap = function () {
- self.velocity = self.jumpStrength;
+ self.velocity = baseJumpStrength * gameSpeed;
try {
LK.getSound('flap').play();
} catch (e) {
console.log("Flap sound error:", e);
@@ -27,8 +27,9 @@
return;
}
// Update dynamic values based on current game speed
self.gravity = baseGravity * gameSpeed;
+ self.jumpStrength = baseJumpStrength * gameSpeed;
self.velocity += self.gravity;
self.y += self.velocity;
// Rotate bird based on velocity
birdGraphics.rotation = Math.max(-0.5, Math.min(1.5, self.velocity * 0.1));
@@ -809,13 +810,8 @@
// Function to set game speed
function setGameSpeed(newSpeed) {
gameSpeed = newSpeed;
updateSpeedDisplay();
- // Update existing bird if it exists
- if (bird) {
- bird.gravity = baseGravity * gameSpeed;
- bird.jumpStrength = baseJumpStrength * gameSpeed;
- }
// Update existing pipes if they exist
for (var i = 0; i < pipes.length; i++) {
if (pipes[i]) {
pipes[i].speed = basePipeSpeed * gameSpeed;