User prompt
Close label ve close button oluşturulurken artık önceki (varsayılan) ayarlar kullanılıyor. Counter (count) metni y konumu 13 piksel yukarı (20 → 7) alındı. Volume label fontSize değeri 63.25'in 1.1 katı (yaklaşık 70) olarak ayarlandı. Bu düzenlemelerle isteklerinize uygun hale getirebilirsiniz.
Code edit (1 edits merged)
Please save this source code
User prompt
place records text up by 10 pixel
User prompt
Increase size of top score attempts last score texts by 500%
User prompt
Increase size of top score attempts last score texts by 200%
User prompt
incrrease size of top score attempts last score texts by %80
User prompt
place top score attempts last score texts to left by 70 pixel
User prompt
Adjust closeLabel text position 3 pixel right 3 pixel up
User prompt
place closeLabel text 6 pixel left
User prompt
place closeLabel text 15 pixel right 14 pixel down
User prompt
place closeLabel text right by 40 pixel
User prompt
increase the size of the close button by %20 and increase size of clolabel text by %10
User prompt
%15 büyüt
User prompt
place close button 10 pixel to right
User prompt
close button 8 pixel right
User prompt
close button 20 pixel left
User prompt
20 pixel left
User prompt
20 pixel down 30 pixel left
User prompt
20 pixel down 30 pixel left
User prompt
place close 30 pixel left 15 pixel down
User prompt
place them 30 pixel down 20 pixel left
User prompt
move 30 pixel left 15 pixel down
User prompt
place close button and x text 300 pixel left and 300 pixel down
Code edit (1 edits merged)
Please save this source code
User prompt
Aşağıdaki kod parçacıklarında istenen ayarlamaları nasıl yapabileceğinizi gösterdim. Değişiklikler özetle: Close Button "X" Texti: Font boyutunu %15 artırdık (30 → 35 yaklaşık). Konumunu 15 piksel yukarı, 10 piksel sola kaydırdık. Close Button: Genişlik ve yüksekliği %15 artırdık (örneğin, radius * 2 değerini 1.15 ile çarptık). Count (counterText): Yazı boyutunu %8 artırdık (100 → 108). PLAY, VOLUME, CREDITS, RECORDS Textleri: Her birinin fontSize değerini %6 artırdık (50 → yaklaşık 53). Ayrıca records modal içindeki skor yazısının fontSize’sini de (30 → yaklaşık 32) güncelledik. Aşağıda ilgili kısımların değiştirilmiş örnek kodunu görebilirsiniz: js Kopyala Düzenle // Count texti (counterText) %8 büyütülmüş: var counterText = new Text2('0', { size: 108, // eskiden 100 idi fill: 0xFFFFFF }); counterText.anchor.set(0, 0); counterText.x = 1320; counterText.y = 20; LK.gui.topLeft.addChild(counterText); js Kopyala Düzenle // PLAY, VOLUME, CREDITS, RECORDS textleri %6 büyütülmüş: var playLabel = new Text2("PLAY", { fontFamily: "Arial", fontSize: 53, // eskiden 50 idi fill: 0xffffff }); playLabel.anchorX = 0.5; playLabel.anchorY = 0.5; playLabel.x = playButton.x - 30; playLabel.y = playButton.y; playLabel.visible = true; menuContainer.addChild(playLabel); var volumeLabel = new Text2("VOLUME", { fontFamily: "Arial", fontSize: 53, // eskiden 50 idi fill: 0xffffff }); volumeLabel.anchorX = 0.5; volumeLabel.anchorY = 0.5; volumeLabel.x = volumeButton.x - 45; volumeLabel.y = volumeButton.y; volumeLabel.visible = true; menuContainer.addChild(volumeLabel); var creditsLabel = new Text2("CREDITS", { fontFamily: "Arial", fontSize: 53, // eskiden 50 idi fill: 0xffffff }); creditsLabel.anchorX = 0.5; creditsLabel.anchorY = 0.5; creditsLabel.x = creditsButton.x - 47; creditsLabel.y = creditsButton.y; creditsLabel.visible = true; menuContainer.addChild(creditsLabel); var recordsLabel = new Text2("RECORDS", { fontFamily: "Arial", fontSize: 53, // eskiden 50 idi fill: 0xffffff }); recordsLabel.anchorX = 0.5; recordsLabel.anchorY = 0.5; recordsLabel.x = recordsButton.x - 47; recordsLabel.y = recordsButton.y; recordsLabel.visible = true; menuContainer.addChild(recordsLabel); js Kopyala Düzenle // showRecords() fonksiyonundaki records modal içindeki skor yazısı, %6 büyütülmüş: var recordsText = new Text2(recordsTextStr, { fontFamily: "Arial", fontSize: 32, // eskiden 30 idi fill: 0xffffff, align: "center" }); recordsText.anchorX = 0.5; recordsText.anchorY = 0.5; recordsText.x = centerX(); recordsText.y = centerY() - 15; recordsText.anchor.set(0.5, 0.5); recordsContainer.addChild(recordsText); js Kopyala Düzenle // Kapatma butonunu ve X textini güncelleyelim: var radius = 25; var closeButton = LK.getAsset('button_close', { anchorX: 0.5, anchorY: 0.5, width: radius * 2 * 1.15, // %15 büyütme height: radius * 2 * 1.15 // %15 büyütme }); closeButton.anchorX = 0.5; closeButton.anchorY = 0.5; // Mevcut closeButton konumlandırma kodunuz burada kalabilir... recordsContainer.addChild(closeButton); // X metni için: var closeLabel = new Text2("X", { fontFamily: "Arial", fontSize: 35, // %15 büyütme (30 * 1.15 ≈ 35) fill: 0xffffff, align: "center" }); closeLabel.anchorX = 0.5; closeLabel.anchorY = 0.5; // Konumunu 15 pixel yukarı ve 10 pixel sola kaydırıyoruz: closeLabel.x = closeButton.x - 10; closeLabel.y = closeButton.y - 15; recordsContainer.addChild(closeLabel); Bu değişikliklerle istenen boyutlandırma ve konum ayarlamalarını yapmış olacaksınız. Kodunuzdaki diğer kısımları da ihtiyaca göre benzer şekilde güncelleyebilirsiniz.
/**** * 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; 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; 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) { gameOver = true; endGame(); } } } 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) { gameOver = true; endGame(); } } } }); } }; self.jump = function () { if (!gameOver) { self.velocityY = self.jumpStrength; } }; 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; passCounter += 1; counterText.setText(passCounter); } } }; 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.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; passCounter += 1; counterText.setText(passCounter); } } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ /**** * Global Variables & Helper Functions ****/ var groundY = 2732; var menuOpen = true; var volumeOn = true; var records = []; // En iyi 5 skoru saklar var gapOffset = 400; var gameStarted = false; var gameOver = false; var screenRight = 2048; var totalUnits = 10; var tubeSpawnThreshold, treeSpawnThreshold; var lastSpawner = null; var gameOverText = null; var passCounter = 0; var lastScore = 0; // Global lastScore variable 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ı var menuBackground = LK.getAsset('menu_background', { anchorX: 0.5, anchorY: 0.5, x: centerX(), y: centerY() }); menuBackground.zIndex = 200; menuContainer.addChild(menuBackground); var menuBackgroundPart = LK.getAsset('menu_background_part', { anchorX: 0.5, anchorY: 0.19, x: centerX(), y: centerY() }); menuBackgroundPart.zIndex = menuBackground.zIndex + 1; // 201 menuContainer.addChild(menuBackgroundPart); // Butonlar ve Label’lar (buton şekilleri başlangıçta görünmez, metinler her zaman görünür) // PLAY var playButton = LK.getAsset('button_play', { anchorX: 0.5, anchorY: 0.5, x: centerX() - 40, y: centerY() + 239 }); playButton.visible = false; menuContainer.addChild(playButton); var playLabel = new Text2("PLAY", { fontFamily: "Arial", fontSize: 63.25, // 15% artış from 55 fill: 0xffffff }); playLabel.anchorX = 0.5; playLabel.anchorY = 0.5; playLabel.x = playButton.x - 30; playLabel.y = playButton.y; playLabel.visible = true; playLabel.zIndex = 1000; // diğer öğelerden yüksek menuContainer.addChild(playLabel); // VOLUME var volumeButton = LK.getAsset('button_volume', { anchorX: 0.5, anchorY: 0.5, x: centerX() - 40, y: centerY() + 355 }); volumeButton.visible = false; menuContainer.addChild(volumeButton); var volumeLabel = new Text2("VOLUME", { fontFamily: "Arial", fontSize: 63.25 * 1.1, // 15% artış fill: 0xffffff }); volumeLabel.anchorX = 0.5; volumeLabel.anchorY = 0.5; volumeLabel.x = volumeButton.x - 45; // Volume textini 12 piksel yukarı taşıyoruz: volumeLabel.y = volumeButton.y - 12; volumeLabel.visible = true; volumeLabel.zIndex = 1000; menuContainer.addChild(volumeLabel); // CREDITS var creditsButton = LK.getAsset('button_credits', { anchorX: 0.5, anchorY: 0.5, x: centerX() - 40, y: centerY() + 461 }); creditsButton.visible = false; menuContainer.addChild(creditsButton); var creditsLabel = new Text2("CREDITS", { fontFamily: "Arial", fontSize: 63.25, // 15% artış fill: 0xffffff }); creditsLabel.anchorX = 0.5; creditsLabel.anchorY = 0.5; creditsLabel.x = creditsButton.x - 47; creditsLabel.y = creditsButton.y; creditsLabel.visible = true; creditsLabel.zIndex = 1000; menuContainer.addChild(creditsLabel); // RECORDS var recordsButton = LK.getAsset('button_records', { anchorX: 0.5, anchorY: 0.5, x: centerX() - 40, y: centerY() + 577 }); recordsButton.visible = false; menuContainer.addChild(recordsButton); var recordsLabel = new Text2("RECORDS", { fontFamily: "Arial", fontSize: 150.25, // örnek: 15% artış from 55 fill: 0xffffff }); recordsLabel.anchorX = 0.5; recordsLabel.anchorY = 0.5; recordsLabel.x = recordsButton.x - 47; // Records textini 12 piksel yukarı taşıyoruz: recordsLabel.y = recordsButton.y - 12; recordsLabel.visible = true; recordsLabel.zIndex = 1000; menuContainer.addChild(recordsLabel); // Fare hareketinde hover kontrolü: butonlar yalnızca imleç üzerindeyken görünür game.move = function (x, y, obj) { if (x >= playButton.x - playButton.width / 2 && x <= playButton.x + playButton.width / 2 && y >= playButton.y - playButton.height / 2 && y <= playButton.y + playButton.height / 2) { playButton.visible = true; } else { playButton.visible = false; } if (x >= volumeButton.x - volumeButton.width / 2 && x <= volumeButton.x + volumeButton.width / 2 && y >= volumeButton.y - volumeButton.height / 2 && y <= volumeButton.y + volumeButton.height / 2) { volumeButton.visible = true; } else { volumeButton.visible = false; } if (x >= creditsButton.x - creditsButton.width / 2 && x <= creditsButton.x + creditsButton.width / 2 && y >= creditsButton.y - creditsButton.height / 2 && y <= creditsButton.y + creditsButton.height / 2) { creditsButton.visible = true; } else { creditsButton.visible = false; } if (x >= recordsButton.x - recordsButton.width / 2 && x <= recordsButton.x + recordsButton.width / 2 && y >= recordsButton.y - recordsButton.height / 2 && y <= recordsButton.y + recordsButton.height / 2) { recordsButton.visible = true; } else { recordsButton.visible = false; } }; var counterText = new Text2('0', { size: 124.2, // 15% artış from 108 fill: 0xFFFFFF }); counterText.anchor.set(0, 0); counterText.x = 1320; counterText.y = 7; 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 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.5, x: centerX(), y: groundY - -25 }); groundAsset.zIndex = 4.1; game.addChild(groundAsset); var ground2Asset = LK.getAsset('ground2', { anchorX: 0.5, anchorY: 0.5, 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; game.addChild(menuContainer); /**** * Helper Functions: Credits, Volume & Records ****/ function createCommonCloseElements(modalWidth, modalHeight) { // close label: base close label font size (hesaplanmış değeri 35 * 1.16 * 1.15 * 1.1 * 1.2 ≈ 62) var closeLabel = new Text2("X", { fontFamily: "Arial", fontSize: Math.round(35 * 1.16 * 1.15), fill: 0xffffff, align: "center" }); closeLabel.anchorX = 0.5; closeLabel.anchorY = 0.5; closeLabel.zIndex = 10000; // Konum: sağ üst köşeye yakın (20px offset) closeLabel.x = centerX() + modalWidth / 2 - 20; closeLabel.y = centerY() - modalHeight / 2 + 20; // close button var radius = 25; var closeButton = LK.getAsset('button_close', { anchorX: 0.5, anchorY: 0.5, width: radius * 2 * 1.2, height: radius * 2 * 1.2 }); closeButton.zIndex = 10000; closeButton.x = closeLabel.x; closeButton.y = closeLabel.y; return { closeLabel: closeLabel, closeButton: closeButton }; } function showCredits() { var creditsContainer = new Container(); creditsContainer.zIndex = 300; // Modal boyutu: 1250x2000 var modalWidth = 1250, modalHeight = 2000; var bg = LK.getAsset('button_credits', { 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 YourName", { fontFamily: "Arial", fontSize: 30, fill: 0xffffff }); creditsText.anchorX = 0.5; creditsText.anchorY = 0.5; creditsText.x = centerX(); creditsText.y = centerY(); creditsContainer.addChild(creditsText); // Ortak close label ve button var commonClose = createCommonCloseElements(modalWidth, modalHeight); creditsContainer.addChild(commonClose.closeLabel); creditsContainer.addChild(commonClose.closeButton); commonClose.closeButton.on('down', function () { game.removeChild(creditsContainer); menuOpen = true; menuContainer.visible = true; }); game.addChild(creditsContainer); } function showVolume() { var volumeContainer = new Container(); volumeContainer.zIndex = 300; // Modal boyutu: 1250x2000 var modalWidth = 1250, modalHeight = 2000; var bg = LK.getAsset('button_credits', { anchorX: 0.5, anchorY: 0.5, width: modalWidth, height: modalHeight, color: 0x000000 }); bg.x = centerX(); bg.y = centerY(); volumeContainer.addChild(bg); var volumeText = new Text2("Volume Settings", { fontFamily: "Arial", fontSize: 30, fill: 0xffffff }); volumeText.anchorX = 0.5; volumeText.anchorY = 0.5; volumeText.x = centerX(); volumeText.y = centerY(); volumeContainer.addChild(volumeText); // Ortak close label ve button var commonClose = createCommonCloseElements(modalWidth, modalHeight); volumeContainer.addChild(commonClose.closeLabel); volumeContainer.addChild(commonClose.closeButton); commonClose.closeButton.on('down', function () { game.removeChild(volumeContainer); menuOpen = true; menuContainer.visible = true; }); game.addChild(volumeContainer); } function showRecords() { var recordsContainer = new Container(); recordsContainer.zIndex = 300; var modalWidth = 1250, modalHeight = 2000; var bg = LK.getAsset('button_credits', { 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; // Records textinin font boyutu 5 kat büyütülmüş (32 -> 160) var recordsText = new Text2(recordsTextStr, { fontFamily: "Arial", fontSize: 160, fill: 0xffffff, align: "center" }); recordsText.anchorX = 0.5; recordsText.anchorY = 0.5; recordsText.x = centerX() - 70; // 12 piksel yukarı taşındı: recordsText.y = centerY() - 27; recordsContainer.addChild(recordsText); var commonClose = createCommonCloseElements(modalWidth, modalHeight); recordsContainer.addChild(commonClose.closeLabel); recordsContainer.addChild(commonClose.closeButton); commonClose.closeButton.on('down', function () { game.removeChild(recordsContainer); menuOpen = true; menuContainer.visible = true; }); game.addChild(recordsContainer); } /**** * 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; }, 2000); LK.setTimeout(function () { resetGame(); }, 2000); } function resetGame() { if (gameOverText) { game.removeChild(gameOverText); gameOverText = null; } 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; gameStarted = false; gameOver = false; lastSpawner = null; passCounter = 0; counterText.setText(passCounter); } /**** * Touch Event ****/ game.down = function (x, y, obj) { if (menuOpen) { if (x >= playButton.x - playButton.width / 2 && x <= playButton.x + playButton.width / 2 && y >= playButton.y - playButton.height / 2 && y <= playButton.y + playButton.height / 2) { menuOpen = false; menuContainer.visible = false; gameStarted = true; var initialTube = new Tube(); game.addChild(initialTube); lastSpawner = initialTube; return; } else if (x >= volumeButton.x - volumeButton.width / 2 && x <= volumeButton.x + volumeButton.width / 2 && y >= volumeButton.y - volumeButton.height / 2 && y <= volumeButton.y + volumeButton.height / 2) { showVolume(); } else if (x >= creditsButton.x - creditsButton.width / 2 && x <= creditsButton.x + creditsButton.width / 2 && y >= creditsButton.y - creditsButton.height / 2 && y <= creditsButton.y + creditsButton.height / 2) { showCredits(); } else if (x >= recordsButton.x - recordsButton.width / 2 && x <= recordsButton.x + recordsButton.width / 2 && y >= recordsButton.y - recordsButton.height / 2 && y <= recordsButton.y + recordsButton.height / 2) { showRecords(); } return; } else if (gameOver) { if (!game.touchDisabled) { menuOpen = true; menuContainer.visible = true; resetGame(); } } 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(); } }); game.children.sort(function (a, b) { return (a.zIndex || 0) - (b.zIndex || 0); }); };
===================================================================
--- original.js
+++ change.js
@@ -240,9 +240,9 @@
y: centerY()
});
menuBackgroundPart.zIndex = menuBackground.zIndex + 1; // 201
menuContainer.addChild(menuBackgroundPart);
-// Butonlar ve Label’lar (başlangıçta buton şekilleri görünmez, metinler her zaman görünür)
+// Butonlar ve Label’lar (buton şekilleri başlangıçta görünmez, metinler her zaman görünür)
// PLAY
var playButton = LK.getAsset('button_play', {
anchorX: 0.5,
anchorY: 0.5,
@@ -253,17 +253,17 @@
menuContainer.addChild(playButton);
var playLabel = new Text2("PLAY", {
fontFamily: "Arial",
fontSize: 63.25,
- // 15% increase from 55
+ // 15% artış from 55
fill: 0xffffff
});
playLabel.anchorX = 0.5;
playLabel.anchorY = 0.5;
playLabel.x = playButton.x - 30;
playLabel.y = playButton.y;
playLabel.visible = true;
-playLabel.zIndex = 1000; // Diğer öğelerden yüksek
+playLabel.zIndex = 1000; // diğer öğelerden yüksek
menuContainer.addChild(playLabel);
// VOLUME
var volumeButton = LK.getAsset('button_volume', {
anchorX: 0.5,
@@ -274,16 +274,17 @@
volumeButton.visible = false;
menuContainer.addChild(volumeButton);
var volumeLabel = new Text2("VOLUME", {
fontFamily: "Arial",
- fontSize: 63.25,
- // 15% increase from 55
+ fontSize: 63.25 * 1.1,
+ // 15% artış
fill: 0xffffff
});
volumeLabel.anchorX = 0.5;
volumeLabel.anchorY = 0.5;
volumeLabel.x = volumeButton.x - 45;
-volumeLabel.y = volumeButton.y;
+// Volume textini 12 piksel yukarı taşıyoruz:
+volumeLabel.y = volumeButton.y - 12;
volumeLabel.visible = true;
volumeLabel.zIndex = 1000;
menuContainer.addChild(volumeLabel);
// CREDITS
@@ -297,9 +298,9 @@
menuContainer.addChild(creditsButton);
var creditsLabel = new Text2("CREDITS", {
fontFamily: "Arial",
fontSize: 63.25,
- // 15% increase from 55
+ // 15% artış
fill: 0xffffff
});
creditsLabel.anchorX = 0.5;
creditsLabel.anchorY = 0.5;
@@ -318,54 +319,51 @@
recordsButton.visible = false;
menuContainer.addChild(recordsButton);
var recordsLabel = new Text2("RECORDS", {
fontFamily: "Arial",
- fontSize: 69.25,
- // 15% increase from 55
+ fontSize: 150.25,
+ // örnek: 15% artış from 55
fill: 0xffffff
});
recordsLabel.anchorX = 0.5;
recordsLabel.anchorY = 0.5;
recordsLabel.x = recordsButton.x - 47;
-recordsLabel.y = recordsButton.y;
+// Records textini 12 piksel yukarı taşıyoruz:
+recordsLabel.y = recordsButton.y - 12;
recordsLabel.visible = true;
recordsLabel.zIndex = 1000;
menuContainer.addChild(recordsLabel);
// Fare hareketinde hover kontrolü: butonlar yalnızca imleç üzerindeyken görünür
game.move = function (x, y, obj) {
- // PLAY
if (x >= playButton.x - playButton.width / 2 && x <= playButton.x + playButton.width / 2 && y >= playButton.y - playButton.height / 2 && y <= playButton.y + playButton.height / 2) {
playButton.visible = true;
} else {
playButton.visible = false;
}
- // VOLUME
if (x >= volumeButton.x - volumeButton.width / 2 && x <= volumeButton.x + volumeButton.width / 2 && y >= volumeButton.y - volumeButton.height / 2 && y <= volumeButton.y + volumeButton.height / 2) {
volumeButton.visible = true;
} else {
volumeButton.visible = false;
}
- // CREDITS
if (x >= creditsButton.x - creditsButton.width / 2 && x <= creditsButton.x + creditsButton.width / 2 && y >= creditsButton.y - creditsButton.height / 2 && y <= creditsButton.y + creditsButton.height / 2) {
creditsButton.visible = true;
} else {
creditsButton.visible = false;
}
- // RECORDS
if (x >= recordsButton.x - recordsButton.width / 2 && x <= recordsButton.x + recordsButton.width / 2 && y >= recordsButton.y - recordsButton.height / 2 && y <= recordsButton.y + recordsButton.height / 2) {
recordsButton.visible = true;
} else {
recordsButton.visible = false;
}
};
var counterText = new Text2('0', {
size: 124.2,
- // 15% increase from 108
+ // 15% artış from 108
fill: 0xFFFFFF
});
counterText.anchor.set(0, 0);
counterText.x = 1320;
-counterText.y = 20;
+counterText.y = 7;
LK.gui.topLeft.addChild(counterText);
var background = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
@@ -397,24 +395,56 @@
y: groundY - 40
});
ground2Asset.zIndex = 0.5;
game.addChild(ground2Asset);
-// İlk karakter oluşturulması
var character = game.addChild(new Character());
character.x = centerX();
character.y = groundY / 2;
game.addChild(menuContainer);
/****
-* Helper Functions: Credits & Records
+* Helper Functions: Credits, Volume & Records
****/
+function createCommonCloseElements(modalWidth, modalHeight) {
+ // close label: base close label font size (hesaplanmış değeri 35 * 1.16 * 1.15 * 1.1 * 1.2 ≈ 62)
+ var closeLabel = new Text2("X", {
+ fontFamily: "Arial",
+ fontSize: Math.round(35 * 1.16 * 1.15),
+ fill: 0xffffff,
+ align: "center"
+ });
+ closeLabel.anchorX = 0.5;
+ closeLabel.anchorY = 0.5;
+ closeLabel.zIndex = 10000;
+ // Konum: sağ üst köşeye yakın (20px offset)
+ closeLabel.x = centerX() + modalWidth / 2 - 20;
+ closeLabel.y = centerY() - modalHeight / 2 + 20;
+ // close button
+ var radius = 25;
+ var closeButton = LK.getAsset('button_close', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: radius * 2 * 1.2,
+ height: radius * 2 * 1.2
+ });
+ closeButton.zIndex = 10000;
+ closeButton.x = closeLabel.x;
+ closeButton.y = closeLabel.y;
+ return {
+ closeLabel: closeLabel,
+ closeButton: closeButton
+ };
+}
function showCredits() {
var creditsContainer = new Container();
creditsContainer.zIndex = 300;
+ // Modal boyutu: 1250x2000
+ var modalWidth = 1250,
+ modalHeight = 2000;
var bg = LK.getAsset('button_credits', {
anchorX: 0.5,
anchorY: 0.5,
- width: 500,
- height: 300,
+ width: modalWidth,
+ height: modalHeight,
color: 0x000000
});
bg.x = centerX();
bg.y = centerY();
@@ -428,28 +458,71 @@
creditsText.anchorY = 0.5;
creditsText.x = centerX();
creditsText.y = centerY();
creditsContainer.addChild(creditsText);
- game.addChild(creditsContainer);
- LK.setTimeout(function () {
+ // Ortak close label ve button
+ var commonClose = createCommonCloseElements(modalWidth, modalHeight);
+ creditsContainer.addChild(commonClose.closeLabel);
+ creditsContainer.addChild(commonClose.closeButton);
+ commonClose.closeButton.on('down', function () {
game.removeChild(creditsContainer);
- }, 3000);
+ menuOpen = true;
+ menuContainer.visible = true;
+ });
+ game.addChild(creditsContainer);
}
+function showVolume() {
+ var volumeContainer = new Container();
+ volumeContainer.zIndex = 300;
+ // Modal boyutu: 1250x2000
+ var modalWidth = 1250,
+ modalHeight = 2000;
+ var bg = LK.getAsset('button_credits', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: modalWidth,
+ height: modalHeight,
+ color: 0x000000
+ });
+ bg.x = centerX();
+ bg.y = centerY();
+ volumeContainer.addChild(bg);
+ var volumeText = new Text2("Volume Settings", {
+ fontFamily: "Arial",
+ fontSize: 30,
+ fill: 0xffffff
+ });
+ volumeText.anchorX = 0.5;
+ volumeText.anchorY = 0.5;
+ volumeText.x = centerX();
+ volumeText.y = centerY();
+ volumeContainer.addChild(volumeText);
+ // Ortak close label ve button
+ var commonClose = createCommonCloseElements(modalWidth, modalHeight);
+ volumeContainer.addChild(commonClose.closeLabel);
+ volumeContainer.addChild(commonClose.closeButton);
+ commonClose.closeButton.on('down', function () {
+ game.removeChild(volumeContainer);
+ menuOpen = true;
+ menuContainer.visible = true;
+ });
+ game.addChild(volumeContainer);
+}
function showRecords() {
var recordsContainer = new Container();
recordsContainer.zIndex = 300;
- // Arka plan
+ var modalWidth = 1250,
+ modalHeight = 2000;
var bg = LK.getAsset('button_credits', {
anchorX: 0.5,
anchorY: 0.5,
- width: 1250,
- height: 2000,
+ width: modalWidth,
+ height: modalHeight,
color: 0x000000
});
bg.x = centerX();
bg.y = centerY();
recordsContainer.addChild(bg);
- // Skor metni
var recordsTextStr = "Top Scores:\n";
for (var i = 0; i < records.length; i++) {
recordsTextStr += i + 1 + ". " + records[i].score + " (Attempt " + records[i].attempt + ")\n";
}
@@ -457,48 +530,25 @@
recordsTextStr += "No records yet.";
}
recordsTextStr += "\nAttempts: " + records.length;
recordsTextStr += "\nLast Score: " + lastScore;
+ // Records textinin font boyutu 5 kat büyütülmüş (32 -> 160)
var recordsText = new Text2(recordsTextStr, {
fontFamily: "Arial",
- fontSize: 32,
- // Yaklaşık %6 artış (30 -> 32)
+ fontSize: 160,
fill: 0xffffff,
align: "center"
});
recordsText.anchorX = 0.5;
recordsText.anchorY = 0.5;
recordsText.x = centerX() - 70;
- recordsText.y = centerY() - 15;
+ // 12 piksel yukarı taşındı:
+ recordsText.y = centerY() - 27;
recordsContainer.addChild(recordsText);
- // Kapatma butonu: Close button ve "X" metni %16 büyütülmüş
- var radius = 25;
- var closeButton = LK.getAsset('button_close', {
- anchorX: 0.5,
- anchorY: 0.5,
- width: radius * 2 * 1.2,
- height: radius * 2 * 1.2
- });
- closeButton.zIndex = 10000; // diğer tüm öğelerden yüksek
- // Örnek konumlandırma:
- closeButton.x = screenRight - radius * 2 * 1.16 / 2 - 390 - 40;
- closeButton.y = radius * 2 * 1.16 / 2 + 375 + 20;
- recordsContainer.addChild(closeButton);
- var closeLabel = new Text2("X", {
- fontFamily: "Arial",
- fontSize: Math.round(35 * 1.16 * 1.15 * 1.1),
- // 10% increase from the previous size
- fill: 0xffffff,
- align: "center"
- });
- closeLabel.anchorX = 0.5;
- closeLabel.anchorY = 0.5;
- closeLabel.zIndex = 10000;
- // Konum: 15 piksel yukarı, 10 piksel sola kaydırılmış
- closeLabel.x = closeButton.x - 30 - 30 + 40 + 15 - 6 + 3;
- closeLabel.y = closeButton.y - 50 + 20 + 14 - 3;
- recordsContainer.addChild(closeLabel);
- closeButton.on('down', function () {
+ var commonClose = createCommonCloseElements(modalWidth, modalHeight);
+ recordsContainer.addChild(commonClose.closeLabel);
+ recordsContainer.addChild(commonClose.closeButton);
+ commonClose.closeButton.on('down', function () {
game.removeChild(recordsContainer);
menuOpen = true;
menuContainer.visible = true;
});
@@ -525,9 +575,9 @@
child.velocityX = 0;
}
});
game.touchDisabled = true;
- lastScore = passCounter; // Global lastScore güncellemesi
+ lastScore = passCounter;
records.push({
score: passCounter,
attempt: records.length + 1
});
@@ -583,9 +633,9 @@
game.addChild(initialTube);
lastSpawner = initialTube;
return;
} else if (x >= volumeButton.x - volumeButton.width / 2 && x <= volumeButton.x + volumeButton.width / 2 && y >= volumeButton.y - volumeButton.height / 2 && y <= volumeButton.y + volumeButton.height / 2) {
- volumeOn = !volumeOn;
+ showVolume();
} else if (x >= creditsButton.x - creditsButton.width / 2 && x <= creditsButton.x + creditsButton.width / 2 && y >= creditsButton.y - creditsButton.height / 2 && y <= creditsButton.y + creditsButton.height / 2) {
showCredits();
} else if (x >= recordsButton.x - recordsButton.width / 2 && x <= recordsButton.x + recordsButton.width / 2 && y >= recordsButton.y - recordsButton.height / 2 && y <= recordsButton.y + recordsButton.height / 2) {
showRecords();