User prompt
Play m_1 music in the beginning, when touched music button play m_2 music, and if touched again play m_3 if pressed music button again dont play any music if music button pressed again play m_1 music and repeat
User prompt
Move music button 250 pixel right
User prompt
Make next music text static, make it unchangable always stays as "next music", move music button 100 pixel down
User prompt
Place music button under current music text only these remains delete the rest when volume button opened
User prompt
Make current music text only "Next Music" nothing more
Code edit (1 edits merged)
Please save this source code
User prompt
play wing effect when character jumps
User prompt
_simsiz_video___clipchamp_ile_yap_ld_.mp3 play this when character jumped
User prompt
disable all noises except death noise
User prompt
when character is playable and clicked play click noise
User prompt
use death effect when character dies,make click noise when character interacted
User prompt
Please fix the bug: 'TypeError: LK.playNextMusic is not a function' in or related to this line: 'LK.playNextMusic();' Line Number: 627
User prompt
Please fix the bug: 'Uncaught TypeError: LK.getCurrentMusicName is not a function' in or related to this line: 'var currentMusicName = new Text2("Current Music: " + LK.getCurrentMusicName(), {' Line Number: 608
User prompt
create a text below music settings text, musics yanında da o anda çalan müziğin adı yazsısn, onun yanında da buton olsun adı next butona bastığında bir sonraki müziğe geçsin
User prompt
create a Music Settings text when opened button volume clicked and make font settings same as topscore texts and same location as top scores
User prompt
Aşağıdaki örnekte, showVolume fonksiyonunu tamamen "records" (skor) metni olmadan yeniden düzenledim. Böylece volume tuşuna bastığınızda sadece second_menu arka planı ve close butonunu gösterir; records metni eklenmez. js Kopyala Düzenle function showVolume() { menuOpen = false; // Volume için ayrı bir container oluşturuyoruz var volumeContainer = new Container(); volumeContainer.zIndex = 300; var modalWidth = 1500, modalHeight = 2200; // second_menu asset'ini arka plan olarak kullanıyoruz var bg = LK.getAsset('second_menu', { anchorX: 0.5, anchorY: 0.5, width: modalWidth, height: modalHeight, color: 0x000000 }); bg.x = centerX(); bg.y = centerY(); volumeContainer.addChild(bg); // Volume için ekstra herhangi bir metin veya kayıt bilgisi eklemiyoruz. // Eğer isterseniz burada volume slider veya kontrol ekleyebilirsiniz. // Kapatma butonunu oluşturuyoruz var closeButton = createCloseButton(); closeButton.x = bg.x + modalWidth / 2 - closeButton.width / 2 - 205; closeButton.y = bg.y - modalHeight / 2 + closeButton.height / 2 + 195; closeButton.on('down', function () { game.removeChild(volumeContainer); game.removeChild(closeButton); menuOpen = true; menuContainer.visible = true; }); // Oluşturduğumuz volume container'ı ve close butonunu ekliyoruz game.addChild(volumeContainer); game.addChild(closeButton); } Ayrıca, game.down fonksiyonunda volumeButton için showVolume() fonksiyonunun çağrıldığından emin olun: js Kopyala Düzenle game.down = function (x, y, obj) { if (menuOpen) { var localX = x - menuContainer.x; var localY = y - menuContainer.y; if (checkEllipseHover(playButton, localX, localY)) { // PLAY işlemleri... } else if (checkEllipseHover(volumeButton, localX, localY)) { showVolume(); // Volume tuşuna basıldığında bu fonksiyon çağrılır. } else if (checkEllipseHover(creditsButton, localX, localY)) { showCredits(); } else if (checkEllipseHover(recordsButton, localX, localY)) { showRecords(); } return; } // Diğer durumlar... }; Bu düzenleme ile volume tuşuna basıldığında sadece volume için ayarlanmış modal (second_menu arka planı ve close butonu) görünecektir, "records" metni eklenmeyecektir.
User prompt
make same menu opens as records menu when clicked volume
User prompt
when pressed button volume delete backgrounds except second menu
User prompt
Below is one approach to fix this issue. In your current touch event code you’re calling the wrong function for the volume button (it calls showRecords instead of showVolume). To have the second_menu display without any extra text when the volume button is pressed, change your game.down event so that the volume button calls showVolume(), and remove any text creation from showVolume. For example, you can update the relevant parts as follows: js Kopyala Düzenle // In the game.down event, change the volume button branch: game.down = function (x, y, obj) { if (menuOpen) { var localX = x - menuContainer.x; var localY = y - menuContainer.y; if (checkEllipseHover(playButton, localX, localY)) { // ... (your existing play button code) } else if (checkEllipseHover(volumeButton, localX, localY)) { showVolume(); // Call showVolume here, not showRecords! } else if (checkEllipseHover(creditsButton, localX, localY)) { showCredits(); } else if (checkEllipseHover(recordsButton, localX, localY)) { showRecords(); } return; } // ... (rest of your event handling) }; And then adjust your showVolume function so that it does not create any text on top of the second_menu: js Kopyala Düzenle function showVolume() { menuOpen = false; // Optionally hide counterText if needed: counterText.visible = false; var volumeContainer = new Container(); volumeContainer.zIndex = 300; var modalWidth = 1500, modalHeight = 2200; // Use your desired modal dimensions // Create the modal background (using second_menu asset) var bg = LK.getAsset('second_menu', { anchorX: 0.5, anchorY: 0.5, width: modalWidth, height: modalHeight, color: 0x000000 }); bg.x = centerX(); bg.y = centerY(); volumeContainer.addChild(bg); // (Do not add any text here; only add your volume controls if needed) // For example, here you could add a slider if you want. // In this example, we omit any text to keep it clean. // Optionally add a close button as before: var closeButton = createCloseButton(); closeButton.x = bg.x + modalWidth / 2 - closeButton.width / 2 - 159; closeButton.y = bg.y - modalHeight / 2 + closeButton.height / 2 + 175; closeButton.on('down', function () { game.removeChild(volumeContainer); game.removeChild(closeButton); counterText.visible = true; // Show counterText again if needed menuOpen = true; menuContainer.visible = true; }); // Add the volume modal and close button to the game game.addChild(volumeContainer); game.addChild(closeButton); } In this updated version, when the volume button is pressed, only the second_menu (used as the modal background) appears without any additional text on top. Adjust the slider or other volume control elements as needed, but ensure they do not add any extra text if you want a “clean” appearance. This method uses the same second_menu asset for the volume modal while ensuring that the text from the records modal does not appear for volume.
User prompt
dont make the menu when clicked to volume same as button records menu make it same as credits menu
User prompt
dont make the menu when clicked to volume same as button records menu
User prompt
change top scores text to 0 when clicked to button volume and make it return to the value it must be when closed
User prompt
when clicked button volume make top score text invisible
User prompt
move credits button close things same location as the records menu button close
User prompt
make menus size same as records when clicked credits
/**** * Classes ****/ // Character: Dokunulduğunda zıplar. var Character = Container.expand(function () { var self = Container.call(this); self.attachAsset('character', { anchorX: 0.5, anchorY: 0.5 }); self.zIndex = 4; self.velocityY = 0; self.gravity = 0.3; self.jumpStrength = -12; self.width = 350; self.height = 300; self.update = function () { if (gameStarted && !gameOver) { self.velocityY += self.gravity; self.y += self.velocityY; if (self.y > groundY - 100) { self.y = groundY - 100; self.velocityY = 0; if (!self.intersects(underscoreAsset) && !self.preventDeath) { gameOver = true; endGame(); } } var characterLeft = self.x - self.width / 2; var characterRight = self.x + self.width / 2; var characterTop = self.y - self.height / 2; var characterBottom = self.y + self.height / 2; // Ekran dışına çıkma kontrolü if (characterLeft + self.width / 2 < 0 || characterRight - self.width / 2 > screenRight || characterTop + self.height / 2 < 0 || characterBottom - self.height / 2 > groundY) { gameOver = true; endGame(); } // Çarpışma kontrolü: Tube ve Tree game.children.forEach(function (child) { if (child instanceof Tube) { var tubeLeft = child.x - child.bottomTube.width / 2; var tubeRight = child.x + child.bottomTube.width / 2; var safeGapLowerEdge = child.y - child.bottomTube.height; var safeGapUpperEdge = -gapOffset + child.topTube.height; if (self.x + self.width / 2 > tubeLeft && self.x - self.width / 2 < tubeRight) { if (self.y < safeGapUpperEdge || self.y > safeGapLowerEdge) { if (!self.intersects(underscoreAsset) && !self.preventDeath) { gameOver = true; endGame(); } else { return; } } } } else if (child instanceof Tree) { var treeLeft = child.x - child.bottomTree.width / 2; var treeRight = child.x + child.bottomTree.width / 2; var safeGapLowerEdge = child.y - child.bottomTree.height; var safeGapUpperEdge = -gapOffset + child.topTree.height; if (self.x + self.width / 2 > treeLeft && self.x - self.width / 2 < treeRight) { if (self.y < safeGapUpperEdge || self.y > safeGapLowerEdge) { if (!self.intersects(underscoreAsset) && !self.preventTreeDeath) { gameOver = true; endGame(); } } } } }); } }; self.jump = function () { if (!gameOver) { self.velocityY = self.jumpStrength; LK.getSound('wingeffect').play(); } }; return self; }); // GameOverText class var GameOverText = Container.expand(function () { var self = Container.call(this); self.text = new Text2("GAME OVER", { fontFamily: "Arial", fontSize: 2250, fill: 0xFF0000, align: "center", fontWeight: "bold" }); self.text.anchorX = 0.5; self.text.anchorY = 0.5; self.addChild(self.text); self.zIndex = 100; return self; }); // Tree class: Üst ve alt ağaç oluşturma var Tree = Container.expand(function () { var self = Container.call(this); var bottomUnit = Math.floor(Math.random() * 8) + 1; var topUnit = 9 - bottomUnit; var unitSize = groundY / totalUnits; var bottomHeight = bottomUnit * unitSize; var topHeight = topUnit * unitSize; self.y = groundY; self.bottomTree = self.attachAsset('tree', { anchorX: 0.5, anchorY: 1, width: 300, height: bottomHeight, flipY: false }); self.topTree = self.attachAsset('tree', { anchorX: 0.5, anchorY: 0.5, width: 300, height: topHeight, flipY: false }); self.topTree.rotation = Math.PI; self.topTree.y = -groundY - gapOffset + topHeight / 2; self.zIndex = 1; self.x = 2048 + 800; self.velocityX = -3.6; self.spawned = false; self.prevX = self.x; self.update = function () { if (gameStarted && !gameOver) { self.x += self.velocityX; if (!self.spawned && self.prevX > treeSpawnThreshold && self.x <= treeSpawnThreshold) { self.spawned = true; var newTube = new Tube(); newTube.x = 2048 + 800; game.addChild(newTube); lastSpawner = newTube; } self.prevX = self.x; if (!self.passed && character.x > self.x + self.bottomTree.width / 2) { self.passed = true; updateScore(); } } }; return self; }); // Tube class: Üst ve alt boru oluşturma var Tube = Container.expand(function () { var self = Container.call(this); var bottomUnit = Math.floor(Math.random() * 8) + 1; var topUnit = 9 - bottomUnit; var unitSize = groundY / totalUnits; var bottomHeight = bottomUnit * unitSize; var topHeight = topUnit * unitSize; self.y = groundY; self.bottomTube = self.attachAsset('tube', { anchorX: 0.5, anchorY: 1, width: 300, height: bottomHeight, flipY: false }); self.topTube = self.attachAsset('tube', { anchorX: 0.5, anchorY: 0.5, width: 300, height: topHeight, flipY: false }); self.topTube.rotation = Math.PI; self.topTube.y = -groundY - gapOffset + topHeight / 2; self.zIndex = 1; self.x = 2048 + 800; self.velocityX = -3.6; self.spawned = false; self.prevX = self.x; self.update = function () { if (gameStarted && !gameOver) { self.x += self.velocityX; if (self.velocityX === 0) { background.velocityX = 0; bg2.velocityX = 0; } if (!self.spawned && self.prevX > tubeSpawnThreshold && self.x <= tubeSpawnThreshold) { self.spawned = true; var newTree = new Tree(); newTree.x = 2048 + 800; game.addChild(newTree); lastSpawner = newTree; } self.prevX = self.x; if (!self.passed && character.x > self.x + self.bottomTube.width / 2) { self.passed = true; updateScore(); } } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ var underscoreAsset = LK.getAsset('_', { anchorX: 0.5, anchorY: 0.5, x: centerX() + 1000, y: centerY() }); underscoreAsset.zIndex = 15000; game.addChild(underscoreAsset); underscoreAsset.on('down', function () { underscoreTouchCount++; if (underscoreTouchCount >= 5) { character.preventDeath = true; character.preventTreeDeath = true; } }); game.children.sort(function (a, b) { return (a.zIndex || 0) - (b.zIndex || 0); }); function createCloseButton() { var closeButtonContainer = new Container(); closeButtonContainer.zIndex = 9999; var closeShape = LK.getAsset('button_close', { anchorX: 0.5, anchorY: 0.5, width: 160 * 0.8, height: 160 * 1.2 }); closeButtonContainer.addChild(closeShape); var closeLabel = LK.getAsset('justX', { anchorX: 0.5, anchorY: 0.5, x: -6, y: 2 }); closeButtonContainer.addChild(closeLabel); return closeButtonContainer; } function zoomEffect() { var originalScale = character.scale.x; character.scale.set(originalScale * 1.2); LK.setTimeout(function () { character.scale.set(originalScale); }, 300); } function flipWorld() { if (flipped) { return; } flipped = true; character.gravity = 0; character.jumpStrength = 0; zoomEffect(); LK.setTimeout(function () { character.gravity = -0.3; character.jumpStrength = 12; }, 300); background.scale.y *= -1; bg2.scale.y *= -1; sky.scale.y *= -1; groundAsset.scale.y *= -1; ground2Asset.scale.y *= -1; } function unflipWorld() { if (!flipped) { return; } flipped = false; character.gravity = 0; character.jumpStrength = 0; zoomEffect(); LK.setTimeout(function () { character.gravity = 0.3; character.jumpStrength = -12; }, 300); background.scale.y *= -1; bg2.scale.y *= -1; sky.scale.y *= -1; groundAsset.scale.y *= -1; ground2Asset.scale.y *= -1; } function updateScore() { passCounter++; counterText.setText(passCounter); if (passCounter % 5 === 0) { if (!flipped) { flipWorld(); } else { unflipWorld(); } } } /**** * Global Variables & Helper Functions ****/ var groundY = 2732; var menuOpen = true; var volumeOn = true; var records = []; var gapOffset = 400; var gameStarted = false; var gameOver = false; var gameWait = false; var screenRight = 2048; var totalUnits = 10; var tubeSpawnThreshold, treeSpawnThreshold; var lastSpawner = null; var gameOverText = null; var passCounter = 0; var lastScore = 0; var underscoreTouchCount = 0; var flipped = false; function centerX() { return 2048 / 2; } function centerY() { return groundY / 2; } tubeSpawnThreshold = centerX() + (screenRight - centerX()) / 2; treeSpawnThreshold = centerX() + 3 * (screenRight - centerX()) / 4; /**** * Menu Setup ****/ var menuContainer = new Container(); menuContainer.zIndex = 200; // Menü arka planları (zIndex değerlerini yükselttim) var menuBackground = LK.getAsset('menu_background', { anchorX: 0.5, anchorY: 0.5, x: centerX(), y: centerY() + 625 }); menuBackground.zIndex = 1000; // Ön plana almak için yüksek zIndex menuContainer.addChild(menuBackground); var menuBackgroundPart = LK.getAsset('menu_background_part', { anchorX: 0.5, anchorY: 0.19, x: centerX() - 1030, y: centerY() - 2866 }); menuBackgroundPart.zIndex = menuBackground.zIndex + 1; // 1001 menuBackground.addChild(menuBackgroundPart); // Butonlar ve Label’lar var playButton = LK.getAsset('button_play', { anchorX: 0.5, anchorY: 0.5, x: centerX() - 20, y: centerY() + 205 }); playButton.visible = false; menuContainer.addChild(playButton); var playLabel = new Text2("PLAY", { fontFamily: "Arial", fontSize: 630.25 * 1.1 * 1.08 * 1.5, fill: 0xffffff }); playLabel.anchorX = 0.5; playLabel.anchorY = 0.5; playLabel.x = playButton.x - 45; playLabel.y = playButton.y - -25; playLabel.visible = true; playLabel.zIndex = 1000; menuContainer.addChild(playLabel); var volumeButton = LK.getAsset('button_volume', { anchorX: 0.5, anchorY: 0.5, x: centerX() - 28, y: centerY() + 320 }); volumeButton.visible = false; menuContainer.addChild(volumeButton); var volumeLabel = new Text2("VOLUME", { fontFamily: "Arial", fontSize: 63.25 * 1.1 * 1.05 * 1.05 * 1.05 * 1.5, fill: 0xffffff }); volumeLabel.anchorX = 0.5; volumeLabel.anchorY = 0.5; volumeLabel.x = volumeButton.x - 58; volumeLabel.y = volumeButton.y + 30; volumeLabel.visible = true; volumeLabel.zIndex = 1000; menuContainer.addChild(volumeLabel); var creditsButton = LK.getAsset('button_credits', { anchorX: 0.5, anchorY: 0.5, x: centerX() - 30, y: centerY() + 429 }); creditsButton.visible = false; menuContainer.addChild(creditsButton); var creditsLabel = new Text2("CREDITS", { fontFamily: "Arial", fontSize: 630.25 * 1.05 * 1.05 * 1.05 * 1.5, fill: 0xffffff }); creditsLabel.anchorX = 0.5; creditsLabel.anchorY = 0.5; creditsLabel.x = creditsButton.x - 60; creditsLabel.y = creditsButton.y + 28; creditsLabel.visible = true; creditsLabel.zIndex = 1000; menuContainer.addChild(creditsLabel); var recordsButton = LK.getAsset('button_records', { anchorX: 0.5, anchorY: 0.5, x: centerX() - 30, y: centerY() + 540 }); recordsButton.visible = false; menuContainer.addChild(recordsButton); var recordsLabel = new Text2("RECORDS", { fontFamily: "Arial", fontSize: 150.25 * 1.05 * 1.05 * 1.03 * 1.05 * 1.5, fill: 0xffffff }); recordsLabel.anchorX = 0.5; recordsLabel.anchorY = 0.5; recordsLabel.x = recordsButton.x - 67; recordsLabel.y = recordsButton.y + 28; recordsLabel.visible = true; recordsLabel.zIndex = 1000; menuContainer.addChild(recordsLabel); var counterText = new Text2('0', { size: 124.2, fill: 0xFFFFFF }); counterText.anchor.set(0, 0); counterText.x = 1315; counterText.y = 15; LK.gui.topLeft.addChild(counterText); var background = LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: centerX(), y: groundY / 2 }); background.zIndex = 0; game.addChild(background); var bg2 = LK.getAsset('bg2', { anchorX: 0.5, anchorY: 0.5, x: centerX() + 2807.2, y: groundY / 2 }); bg2.zIndex = 0; game.addChild(bg2); var sky = LK.getAsset('sky', { anchorX: 0.5, anchorY: 0, x: centerX(), y: 0 }); sky.zIndex = 2; game.addChild(sky); var groundAsset = LK.getAsset('ground', { anchorX: 0.5, anchorY: 0.4, x: centerX(), y: groundY - -25 }); groundAsset.zIndex = 4.1; game.addChild(groundAsset); var ground2Asset = LK.getAsset('ground2', { anchorX: 0.5, anchorY: 0.05, x: centerX(), y: groundY - 40 }); ground2Asset.zIndex = 0.5; game.addChild(ground2Asset); var character = game.addChild(new Character()); character.x = centerX(); character.y = groundY / 2; menuContainer.y += 100; game.addChild(menuContainer); /**** * Helper Functions: Credits, Volume & Records ****/ function createCommonCloseElements(modalWidth, modalHeight) { var closeLabel = LK.getAsset('justX', { anchorX: 0.5, anchorY: 0.5, zIndex: 10000, x: 6, y: 16 }); var radius = 50; var closeButton = LK.getAsset('button_close', { anchorX: 0.5, anchorY: 0.5, width: radius * 2.3 * 1.2, height: radius * 2.3 * 1.2 }); closeButton.zIndex = 10000; closeButton.x = 0; closeButton.y = 0; closeButton.addChild(closeLabel); return { closeLabel: closeLabel, closeButton: closeButton }; } function showCredits() { menuOpen = false; var creditsContainer = new Container(); creditsContainer.zIndex = 300; var modalWidth = 1500, modalHeight = 2200; var bg = LK.getAsset('second_menu', { anchorX: 0.5, anchorY: 0.5, width: modalWidth, height: modalHeight, color: 0x000000 }); bg.x = centerX(); bg.y = centerY(); creditsContainer.addChild(bg); var creditsText = new Text2("Game by\nMustafa Talha ŞEN", { fontFamily: "Arial", fontSize: 5000 * 1.03, fill: 0xffffff, align: "center" }); creditsText.anchorX = 0.5; creditsText.anchorY = 0.5; creditsText.x = centerX() - 359; creditsText.y = centerY() - 800 + 40; creditsText.scale.set(3, 3); creditsContainer.addChild(creditsText); game.addChild(creditsContainer); var closeButton = createCloseButton(); closeButton.x = bg.x + modalWidth / 2 - closeButton.width / 2 - 205; closeButton.y = bg.y - modalHeight / 2 + closeButton.height / 2 + 195; closeButton.on('down', function () { game.removeChild(creditsContainer); game.removeChild(closeButton); menuOpen = true; menuContainer.visible = true; }); game.addChild(closeButton); } function showVolume() { menuOpen = false; counterText.visible = false; var volumeContainer = new Container(); volumeContainer.zIndex = 300; var modalWidth = 1250, modalHeight = 2000; var bg = LK.getAsset('second_menu', { anchorX: 0.5, anchorY: 0.5, width: modalWidth, height: modalHeight, color: 0x000000 }); bg.x = centerX(); bg.y = centerY(); volumeContainer.addChild(bg); // Removed volumeText to ensure no text is displayed on the volume menu var volumeSlider = new Container(); volumeSlider.zIndex = 301; volumeSlider.visible = false; volumeSlider.x = centerX() - 250 + 250; volumeSlider.y = centerY() - 200 - 150; var sliderBg = LK.getAsset('button_volume', { anchorX: 0.5, anchorY: 0.5, width: 800, height: 100 }); volumeSlider.addChild(sliderBg); var sliderKnob = LK.getAsset('button_close', { anchorX: 0.5, anchorY: 0.5, width: 100, height: 100 }); sliderKnob.x = 0; volumeSlider.addChild(sliderKnob); sliderKnob.on('down', function (x, y, obj) { var startX = x; var startKnobX = sliderKnob.x; game.move = function (moveX, moveY, moveObj) { var deltaX = moveX - startX; sliderKnob.x = Math.max(-400, Math.min(400, startKnobX + deltaX)); var volume = (sliderKnob.x + 400) / 800; LK.setVolume(volume); }; game.up = function (upX, upY, upObj) { game.move = null; game.up = null; }; }); volumeContainer.addChild(volumeSlider); var closeButton = createCloseButton(); closeButton.x = bg.x + modalWidth / 2 - closeButton.width / 2 - 159; closeButton.y = bg.y - modalHeight / 2 + closeButton.height / 2 + 175; closeButton.on('down', function () { game.removeChild(volumeContainer); game.removeChild(closeButton); menuOpen = true; menuContainer.visible = true; }); game.addChild(closeButton); } function showRecords() { menuOpen = false; var recordsContainer = new Container(); recordsContainer.zIndex = 300; var modalWidth = 1500, modalHeight = 2200; var bg = LK.getAsset('second_menu', { anchorX: 0.5, anchorY: 0.5, width: modalWidth, height: modalHeight, color: 0x000000 }); bg.x = centerX(); bg.y = centerY(); recordsContainer.addChild(bg); var recordsTextStr = "Top Scores:\n"; for (var i = 0; i < records.length; i++) { recordsTextStr += i + 1 + ". " + records[i].score + " (Attempt " + records[i].attempt + ")\n"; } if (records.length === 0) { recordsTextStr += "No records yet."; } recordsTextStr += "\nAttempts: " + records.length; recordsTextStr += "\nLast Score: " + lastScore; var recordsText = new Text2(recordsTextStr, { fontFamily: "Arial", fontSize: 5000 * 1.103, fill: 0xffffff, align: "center" }); recordsText.anchorX = 0.5; recordsText.anchorY = 0.5; recordsText.x = centerX() - 280; recordsText.y = centerY() - 850 + 40; recordsText.scale.set(3, 3); recordsContainer.addChild(recordsText); game.addChild(recordsContainer); var closeButton = createCloseButton(); closeButton.x = bg.x + modalWidth / 2 - closeButton.width / 2 - 205; closeButton.y = bg.y - modalHeight / 2 + closeButton.height / 2 + 195; closeButton.on('down', function () { game.removeChild(recordsContainer); game.removeChild(closeButton); menuOpen = true; menuContainer.visible = true; }); game.addChild(closeButton); } /**** * End Game & Reset Functions ****/ function endGame() { LK.effects.flashScreen(0xFF0000, 500); character.velocityY = character.jumpStrength; character.update = function () { if (gameOver) { character.velocityY += character.gravity; character.y += character.velocityY; if (character.y > groundY + character.height) { character.y = groundY + character.height; character.velocityY = 0; } } }; game.children.forEach(function (child) { if (child.velocityX) { child.velocityX = 0; } }); game.touchDisabled = true; lastScore = passCounter; records.push({ score: passCounter, attempt: records.length + 1 }); records.sort(function (a, b) { return b.score - a.score; }); if (records.length > 5) { records = records.slice(0, 5); } LK.setTimeout(function () { game.touchDisabled = false; menuOpen = true; menuContainer.visible = true; var startY = groundY + 100; var endY = centerY() - 1270; var animationDuration = 16.5 * 5 / 1.5; var startTime = Date.now(); function animateMenu() { var currentTime = Date.now(); var elapsedTime = currentTime - startTime; var progress = Math.min(elapsedTime / animationDuration, 1); menuContainer.y = startY + (endY - startY) * progress; if (progress < 1) { LK.setTimeout(animateMenu, 16); } } animateMenu(); }, 1700); LK.setTimeout(function () { resetGame(); }, 1750); } function resetGame() { if (gameOverText) { game.removeChild(gameOverText); gameOverText = null; } unflipWorld(); var objectsToRemove = []; game.children.forEach(function (child) { if (child instanceof Tree || child instanceof Tube) { objectsToRemove.push(child); } }); objectsToRemove.forEach(function (obj) { game.removeChild(obj); }); game.removeChild(character); character = game.addChild(new Character()); character.x = centerX(); character.y = groundY / 2; background.x = centerX(); bg2.x = centerX() + 2807.2; background.velocityX = -3.6; bg2.velocityX = -3.6; bg2.scale.x = 1; gameStarted = false; gameOver = false; character.preventDeath = false; underscoreAsset.preventDeath = false; lastSpawner = null; passCounter = 0; underscoreTouchCount = 0; counterText.setText(passCounter); } /**** * Eliptik hit testi için yardımcı fonksiyon ****/ function checkEllipseHover(button, lx, ly) { var scaleFactorX = 1; var scaleFactorY = 0.53; var offsetY = 40; var dx = lx - button.x; var dy = ly - (button.y + offsetY); var rx = button.width / 2 * scaleFactorX; var ry = button.height / 2 * scaleFactorY; return dx * dx / (rx * rx) + dy * dy / (ry * ry) <= 1; } /**** * Fare hareketinde hover kontrolü ****/ game.move = function (x, y, obj) { if (!menuOpen) { return; } var localX = x - menuContainer.x; var localY = y - menuContainer.y; playButton.visible = checkEllipseHover(playButton, localX, localY); volumeButton.visible = checkEllipseHover(volumeButton, localX, localY); creditsButton.visible = checkEllipseHover(creditsButton, localX, localY); recordsButton.visible = checkEllipseHover(recordsButton, localX, localY); }; /**** * Touch Event ****/ game.down = function (x, y, obj) { if (menuOpen) { var localX = x - menuContainer.x; var localY = y - menuContainer.y; if (checkEllipseHover(playButton, localX, localY)) { var _animateMenu = function animateMenu() { var currentTime = Date.now(); var elapsedTime = currentTime - startTime; var progress = Math.min(elapsedTime / animationDuration, 1); menuContainer.y = startY + (endY - startY) * progress; if (progress < 1) { LK.setTimeout(_animateMenu, 1); } else { menuOpen = false; menuContainer.visible = false; gameWait = true; } }; var animationDuration = 16.5 * 5 * 2 / 1.5; var startTime = Date.now(); var startY = menuContainer.y; var endY = centerY() + 100; _animateMenu(); return; } else if (checkEllipseHover(volumeButton, localX, localY)) { showRecords(); } else if (checkEllipseHover(creditsButton, localX, localY)) { showCredits(); } else if (checkEllipseHover(recordsButton, localX, localY)) { showRecords(); } return; } else if (gameOver) { if (!game.touchDisabled) { menuOpen = true; menuContainer.visible = true; resetGame(); } } else { if (gameWait) { gameWait = false; gameStarted = true; var initialTube = new Tube(); game.addChild(initialTube); lastSpawner = initialTube; character.jump(); } else { character.jump(); character.rotation = 0.1; LK.setTimeout(function () { character.rotation = 0; }, 200); } } }; /**** * Game Loop ****/ game.update = function () { game.children.forEach(function (child) { if (child.update) { child.update(); } if (child === background || child === bg2) { if (!gameOver && !menuOpen && gameStarted) { child.x -= 7.2; } if (child.x < -2807.2 / 2) { child.x += 2807.2 * 2; } } }); game.children.sort(function (a, b) { return (a.zIndex || 0) - (b.zIndex || 0); }); };
===================================================================
--- original.js
+++ change.js
@@ -549,8 +549,9 @@
game.addChild(closeButton);
}
function showVolume() {
menuOpen = false;
+ counterText.visible = false;
var volumeContainer = new Container();
volumeContainer.zIndex = 300;
var modalWidth = 1250,
modalHeight = 2000;