User prompt
bir tuşu düzelteceğim derken tüm tuşları bozuyorsun
User prompt
Geri tuşu ile ilgili yapılan tüm hataları düzelt
User prompt
Geri tuşu çalışmasıyla ilgili hatalar var.
User prompt
en yüksek skor ve son yapılan skor hatalarını düzelt ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Oyunu kaybettiğimizde oyun kapanması değil sadece ana menüye dönsün.
User prompt
Oyundaki skor tablosu sadece gerçek oyuncuların skorunu göstersin ve skor tablosu sıfırdan başlasın yani daha önce yapılan hiçbir skor sayılmasın yapılan ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Sen adında, bir de oyuncunun etiketi adında iki kişi var. O ikisi de aynı kişi. Lütfen bunu düzelt.
User prompt
Skor tablosundaki Sahte kişiler olmasın Sadece gerçek oyuncuların skorları gözüksün ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Oyuncunun ismi yazan yazıyı biraz aşağıya çek.
User prompt
Oyuncu isimleri boş yere o kadar uzun olmasın. Mesela Oyuncu 1, Oyuncu 2, Oyuncu 3 diye ilerleyebilir.
User prompt
oyuna ve skor yazılarını tuşlarını aşağı çek ve oyuncu ismimizi onların üstüne koy
User prompt
kullanıcı ismimizi gözükür bir renk yap ya da arkasına bir panel koy böylece rengi gözükür
User prompt
oyuna girdiğimizde skor ve oyuna tuşunun üstünde kullanıcı ismimiz olsun ve gerçek kişiler ile tabloda yarışalım ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Oyundaki hiçbir şeyi silme veya bozma, sadece hataları düzelt.
User prompt
skor kısmından çıkmak için eklediğin geri tuşu çalışmıyor düzelt
User prompt
Skor tablosu çok sıkışık ve arka planı olmadığı için çok kötü duruyor. Arka plan ekle ve daha düzgün hale getir.
User prompt
Please fix the bug: 'Timeout.tick error: Invalid value. Only literals or 1-level deep objects/arrays containing literals are allowed.' in or related to this line: 'storage.globalLeaderboard = [{' Line Number: 401 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Başka kulağıncıların da skorların gözükmesi oyunu bozdu bazı hataları düzelt ve tekrar ekle. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Skora Tıklayınca Sadece Bizim Skorlar Değil Başka Kullanıcılarında Yaptığı Skorlar Gözüksün. Böylece Rekabet Artacak Ve Oyun Daha Çok Oynanacak. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Şimdi tuşların algılama sistemi tamam oldu da bir iki kere tıklayınca anca açılıyorlar böyle hataları düzelt
User prompt
Please fix the bug: 'TypeError: storage.set is not a function' in or related to this line: 'storage.set('lastScore', currentScore);' Line Number: 507 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Oyuna ve skor tuşları çalışmıyor. Ya kaldır ya düzelt.
User prompt
Oyuna ve sport düşlerinin algılama sistemi yok. Onları da ekle. ↪💡 Consider importing and using the following plugins: @upit/storage.v1, @upit/tween.v1
User prompt
oyundaki düğmeleri kodları herşeyi düzelt
User prompt
oyuna ve skor tuşları da çalışsın oynaya basınca oyun başlasın skor tuşuna basınca hem bizim en yüksek rekorumuz ve diğer kullanıcıların rekorları gözüksün ↪💡 Consider importing and using the following plugins: @upit/storage.v1
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* 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 = 0.8;
self.jumpStrength = -12;
self.flap = function () {
self.velocity = self.jumpStrength;
LK.getSound('flap').play();
};
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;
}
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
if (self.y < 30) {
self.y = 30;
}
};
return self;
});
var Pipe = Container.expand(function (gapCenterY) {
var self = Container.call(this);
self.gapSize = 600;
self.speed = -3;
self.passed = false;
self.gapCenterY = gapCenterY;
// Create top pipe
var topPipe = self.attachAsset('pipe', {
anchorX: 0.5,
anchorY: 1
});
topPipe.y = gapCenterY - self.gapSize / 2;
topPipe.height = gapCenterY - self.gapSize / 2;
// Create bottom pipe
var bottomPipe = self.attachAsset('pipe', {
anchorX: 0.5,
anchorY: 0
});
bottomPipe.y = gapCenterY + self.gapSize / 2;
bottomPipe.height = 2732 - 150 - (gapCenterY + self.gapSize / 2);
self.update = function () {
if (!gameStarted) {
// Don't move pipes before game starts
return;
}
self.x += self.speed;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Game variables
var bird;
var pipes = [];
var ground;
var topBarrier;
var bottomBarrier;
var gameStarted = false;
var gameOver = false;
var showMainMenu = true;
var showLeaderboard = false;
var pipeSpacing = 600; // Consistent spacing between all pipes - balanced distance
// Create score display
var scoreTxt = new Text2('SKOR: 0', {
size: 80,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
scoreTxt.stroke = 0x000000;
scoreTxt.strokeThickness = 4;
LK.gui.top.addChild(scoreTxt);
scoreTxt.y = 100;
// Create username background panel
var usernamePanel = LK.getAsset('ground', {
anchorX: 0.5,
anchorY: 0.5,
width: 500,
height: 90,
alpha: 0.9
});
usernamePanel.tint = 0x333333;
LK.gui.center.addChild(usernamePanel);
usernamePanel.y = -100;
// Create username display
var usernameText = new Text2('', {
size: 60,
fill: 0x00FF00
});
usernameText.anchor.set(0.5, 0.5);
usernameText.stroke = 0x000000;
usernameText.strokeThickness = 3;
LK.gui.center.addChild(usernameText);
usernameText.y = -100;
// 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;
LK.gui.center.addChild(mainMenuTitle);
mainMenuTitle.y = -200;
// Create play button
var playButton = LK.getAsset('ground', {
anchorX: 0.5,
anchorY: 0.5,
width: 300,
height: 80,
alpha: 0.9
});
playButton.tint = 0x32CD32;
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 score button
var scoreButton = LK.getAsset('ground', {
anchorX: 0.5,
anchorY: 0.5,
width: 300,
height: 80,
alpha: 0.9
});
scoreButton.tint = 0x4169E1;
LK.gui.center.addChild(scoreButton);
scoreButton.y = 150;
var scoreButtonText = new Text2('SKOR', {
size: 50,
fill: 0xFFFFFF
});
scoreButtonText.anchor.set(0.5, 0.5);
scoreButtonText.stroke = 0x000000;
scoreButtonText.strokeThickness = 3;
LK.gui.center.addChild(scoreButtonText);
scoreButtonText.y = 150;
// 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('ground', {
anchorX: 0.5,
anchorY: 0.5,
width: 400,
height: 100,
alpha: 0.8
});
instructionBg.tint = 0x000000;
instructionBg.visible = false;
LK.gui.center.addChild(instructionBg);
LK.gui.center.addChild(instructionTxt);
// Create leaderboard background
var leaderboardBg = LK.getAsset('ground', {
anchorX: 0.5,
anchorY: 0.5,
width: 1800,
height: 2200,
alpha: 0.95
});
leaderboardBg.tint = 0x1a1a1a;
leaderboardBg.visible = false;
LK.gui.center.addChild(leaderboardBg);
// Create leaderboard elements
var leaderboardTitle = new Text2('SKOR TABLOSU', {
size: 80,
fill: 0xFFD700
});
leaderboardTitle.anchor.set(0.5, 0.5);
leaderboardTitle.stroke = 0x000000;
leaderboardTitle.strokeThickness = 4;
leaderboardTitle.visible = false;
LK.gui.center.addChild(leaderboardTitle);
leaderboardTitle.y = -350;
var highScoreText = new Text2('EN YÜKSEK SKOR: 0', {
size: 50,
fill: 0xFFFFFF
});
highScoreText.anchor.set(0.5, 0.5);
highScoreText.stroke = 0x000000;
highScoreText.strokeThickness = 3;
highScoreText.visible = false;
LK.gui.center.addChild(highScoreText);
highScoreText.y = -250;
var currentScoreText = new Text2('SON SKOR: 0', {
size: 50,
fill: 0xFFFFFF
});
currentScoreText.anchor.set(0.5, 0.5);
currentScoreText.stroke = 0x000000;
currentScoreText.strokeThickness = 3;
currentScoreText.visible = false;
LK.gui.center.addChild(currentScoreText);
currentScoreText.y = -180;
// Create back button for leaderboard
var backButton = LK.getAsset('ground', {
anchorX: 0.5,
anchorY: 0.5,
width: 300,
height: 80,
alpha: 0.9
});
backButton.tint = 0xFF4500;
backButton.visible = false;
LK.gui.center.addChild(backButton);
backButton.y = 350;
var backButtonText = new Text2('GERİ', {
size: 50,
fill: 0xFFFFFF
});
backButtonText.anchor.set(0.5, 0.5);
backButtonText.stroke = 0x000000;
backButtonText.strokeThickness = 3;
backButtonText.visible = false;
LK.gui.center.addChild(backButtonText);
backButtonText.y = 350;
// Create bird
bird = game.addChild(new Bird());
bird.x = 400;
bird.y = 1366;
// 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 ground
ground = game.addChild(LK.getAsset('ground', {
anchorX: 0,
anchorY: 1
}));
ground.x = 0;
ground.y = 2732;
// Create pipe function
function createPipe() {
var minGapY = 500;
var maxGapY = 2032; // 2732 - 150 - 600 (adjusted for larger gap)
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 + 200; // First pipe position
} 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;
showLeaderboard = false;
LK.setScore(0);
scoreTxt.setText('SKOR: 0');
// Show main menu
usernamePanel.visible = true;
usernameText.visible = true;
mainMenuTitle.visible = true;
playButton.visible = true;
playButtonText.visible = true;
scoreButton.visible = true;
scoreButtonText.visible = true;
// Hide instruction
instructionTxt.visible = false;
instructionBg.visible = false;
// Hide leaderboard elements
leaderboardBg.visible = false;
leaderboardTitle.visible = false;
highScoreText.visible = false;
currentScoreText.visible = false;
backButton.visible = false;
backButtonText.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
usernamePanel.visible = false;
usernameText.visible = false;
mainMenuTitle.visible = false;
playButton.visible = false;
playButtonText.visible = false;
scoreButton.visible = false;
scoreButtonText.visible = false;
// Show instruction
instructionTxt.visible = true;
instructionBg.visible = true;
}
// Create global leaderboard display elements
var globalLeaderboardText = new Text2('GLOBAL LIDERLER:', {
size: 50,
fill: 0xFFD700
});
globalLeaderboardText.anchor.set(0.5, 0.5);
globalLeaderboardText.stroke = 0x000000;
globalLeaderboardText.strokeThickness = 3;
globalLeaderboardText.visible = false;
LK.gui.center.addChild(globalLeaderboardText);
globalLeaderboardText.y = -80;
var globalScoresList = [];
for (var i = 0; i < 5; i++) {
var scoreText = new Text2('', {
size: 40,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0.5);
scoreText.stroke = 0x000000;
scoreText.strokeThickness = 2;
scoreText.visible = false;
LK.gui.center.addChild(scoreText);
scoreText.y = -10 + i * 50;
globalScoresList.push(scoreText);
}
// Function to show leaderboard
function showLeaderboardScreen() {
showMainMenu = false;
showLeaderboard = true;
// Hide main menu elements
usernamePanel.visible = false;
usernameText.visible = false;
mainMenuTitle.visible = false;
playButton.visible = false;
playButtonText.visible = false;
scoreButton.visible = false;
scoreButtonText.visible = false;
// Show leaderboard elements
leaderboardBg.visible = true;
leaderboardTitle.visible = true;
highScoreText.visible = true;
currentScoreText.visible = true;
backButton.visible = true;
backButtonText.visible = true;
globalLeaderboardText.visible = true;
// Update score displays - ensure we're using the stored values
var highScore = storage.highScore || 0;
var lastScore = storage.lastScore || 0;
highScoreText.setText('EN YÜKSEK SKOR: ' + highScore);
currentScoreText.setText('SON SKOR: ' + lastScore);
// Always ensure fresh leaderboard arrays exist - no fake players, only real ones
storage.globalLeaderboardNames = storage.globalLeaderboardNames || [];
storage.globalLeaderboardScores = storage.globalLeaderboardScores || [];
// Get global leaderboard from storage
var globalNames = storage.globalLeaderboardNames || [];
var globalScores = storage.globalLeaderboardScores || [];
// Add current player's high score if it doesn't exist and is greater than 0
var playerExists = false;
var currentUsername = storage.username || 'Oyuncu';
for (var i = 0; i < globalNames.length; i++) {
if (globalNames[i] === currentUsername) {
globalScores[i] = Math.max(globalScores[i], highScore);
playerExists = true;
break;
}
}
if (!playerExists && highScore > 0) {
globalNames.push(currentUsername);
globalScores.push(highScore);
}
// Sort scores in descending order by creating index array
var indices = [];
for (var i = 0; i < globalScores.length; i++) {
indices.push(i);
}
indices.sort(function (a, b) {
return globalScores[b] - globalScores[a];
});
// Create sorted arrays
var sortedNames = [];
var sortedScores = [];
for (var i = 0; i < indices.length; i++) {
sortedNames.push(globalNames[indices[i]]);
sortedScores.push(globalScores[indices[i]]);
}
// Keep only top 10 scores
if (sortedNames.length > 10) {
sortedNames = sortedNames.slice(0, 10);
sortedScores = sortedScores.slice(0, 10);
}
// Save updated leaderboard
storage.globalLeaderboardNames = sortedNames;
storage.globalLeaderboardScores = sortedScores;
// Display global scores
for (var i = 0; i < globalScoresList.length; i++) {
if (i < sortedNames.length) {
var displayText = i + 1 + '. ' + sortedNames[i] + ': ' + sortedScores[i];
globalScoresList[i].setText(displayText);
globalScoresList[i].visible = true;
} else {
globalScoresList[i].visible = false;
}
}
}
// Function to hide leaderboard and return to main menu
function hideLeaderboard() {
showLeaderboard = false;
showMainMenu = true;
// Hide leaderboard elements
leaderboardBg.visible = false;
leaderboardTitle.visible = false;
highScoreText.visible = false;
currentScoreText.visible = false;
backButton.visible = false;
backButtonText.visible = false;
globalLeaderboardText.visible = false;
// Hide global scores list
for (var i = 0; i < globalScoresList.length; i++) {
globalScoresList[i].visible = false;
}
// Show main menu elements
usernamePanel.visible = true;
usernameText.visible = true;
mainMenuTitle.visible = true;
playButton.visible = true;
playButtonText.visible = true;
scoreButton.visible = true;
scoreButtonText.visible = true;
}
// Reset all leaderboard data - start fresh
storage.globalLeaderboardNames = [];
storage.globalLeaderboardScores = [];
// Don't reset personal high score and last score - keep them persistent
// Initialize username if not exists
if (!storage.username) {
// Get next available player number
var playerNumber = 1;
var existingNames = storage.globalLeaderboardNames || [];
while (existingNames.indexOf('Oyuncu ' + playerNumber) !== -1) {
playerNumber++;
}
storage.username = 'Oyuncu ' + playerNumber;
}
// Display username in main menu
usernameText.setText(storage.username);
// Global leaderboard is now initialized in showLeaderboardScreen function
// Initialize game
createPipe();
createPipe();
// Touch/click handler
game.down = function (x, y, obj) {
if (gameOver) {
resetGame();
return;
}
if (showMainMenu) {
// Check play button (OYNA) - center screen, Y offset +50
if (x >= 1024 - 150 && x <= 1024 + 150 && y >= 1366 + 50 - 40 && y <= 1366 + 50 + 40) {
// 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
LK.setTimeout(function () {
startGameFromMenu();
}, 150);
return;
}
// Check score button (SKOR) - center screen, Y offset +150
if (x >= 1024 - 150 && x <= 1024 + 150 && y >= 1366 + 150 - 40 && y <= 1366 + 150 + 40) {
// Add visual feedback with tween
tween(scoreButton, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 100,
onFinish: function onFinish() {
tween(scoreButton, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100
});
}
});
// Add small delay to prevent double clicks
LK.setTimeout(function () {
showLeaderboardScreen();
}, 150);
return;
}
return;
}
if (showLeaderboard) {
// Check back button (GERİ) - center screen, Y offset +350
if (x >= 1024 - 150 && x <= 1024 + 150 && y >= 1366 + 350 - 40 && y <= 1366 + 350 + 40) {
// Add visual feedback with tween
tween(backButton, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 100,
onFinish: function onFinish() {
tween(backButton, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100
});
}
});
// Add small delay to prevent double clicks
LK.setTimeout(function () {
hideLeaderboard();
}, 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 || showLeaderboard) return;
// Only run game logic if game has started
if (gameStarted) {
// Check ground collision
if (bird.y + 20 >= 2732 - 150) {
gameOver = true;
// Save score before showing game over
var currentScore = LK.getScore();
storage.lastScore = currentScore;
var currentHighScore = storage.highScore || 0;
if (currentScore > currentHighScore) {
storage.highScore = currentScore;
}
resetGame();
return;
}
// Check ceiling collision
if (bird.y - 20 <= 0) {
gameOver = true;
// Save score before showing game over
var currentScore = LK.getScore();
storage.lastScore = currentScore;
var currentHighScore = storage.highScore || 0;
if (currentScore > currentHighScore) {
storage.highScore = currentScore;
}
resetGame();
return;
}
// Check pipe collisions and scoring - only check pipes that are near the bird
for (var i = 0; i < pipes.length; i++) {
var pipe = pipes[i];
// Only check pipes that are within reasonable distance of the bird
if (Math.abs(pipe.x - bird.x) < 200) {
// Check if bird is within pipe horizontally
if (bird.x + 30 > pipe.x - 50 && bird.x - 30 < pipe.x + 50) {
// Check collision with top pipe
if (bird.y - 20 < pipe.gapCenterY - pipe.gapSize / 2) {
gameOver = true;
// Save score before showing game over
var currentScore = LK.getScore();
storage.lastScore = currentScore;
var currentHighScore = storage.highScore || 0;
if (currentScore > currentHighScore) {
storage.highScore = currentScore;
}
resetGame();
return;
}
// Check collision with bottom pipe
if (bird.y + 20 > pipe.gapCenterY + pipe.gapSize / 2) {
gameOver = true;
// Save score before showing game over
var currentScore = LK.getScore();
storage.lastScore = currentScore;
var currentHighScore = storage.highScore || 0;
if (currentScore > currentHighScore) {
storage.highScore = currentScore;
}
resetGame();
return;
}
}
}
// Check scoring - 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('SKOR: ' + LK.getScore());
LK.getSound('score').play();
}
}
// Create new pipes - maintain consistent spacing
if (pipes.length === 0 || pipes.length > 0 && pipes[pipes.length - 1].x <= 2048 + 200 - pipeSpacing) {
createPipe();
}
// Remove off-screen pipes - only check every 10 frames to reduce lag
if (LK.ticks % 10 === 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
@@ -531,17 +531,10 @@
resetGame();
return;
}
if (showMainMenu) {
- // Convert click coordinates to GUI coordinates for proper button detection
- var guiPos = LK.gui.center.toLocal({
- x: x,
- y: y
- });
- // Check play button (OYNA) - positioned at GUI center Y + 50 with proper click area
- var playButtonX = 0; // playButton is centered at GUI center (0,0)
- var playButtonY = 50; // playButton.y = 50
- if (guiPos.x >= playButtonX - 150 && guiPos.x <= playButtonX + 150 && guiPos.y >= playButtonY - 40 && guiPos.y <= playButtonY + 40) {
+ // Check play button (OYNA) - center screen, Y offset +50
+ if (x >= 1024 - 150 && x <= 1024 + 150 && y >= 1366 + 50 - 40 && y <= 1366 + 50 + 40) {
// Add visual feedback with tween
tween(playButton, {
scaleX: 1.1,
scaleY: 1.1
@@ -561,12 +554,10 @@
startGameFromMenu();
}, 150);
return;
}
- // Check score button (SKOR) - positioned at GUI center Y + 150 with proper click area
- var scoreButtonX = 0; // scoreButton is centered at GUI center (0,0)
- var scoreButtonY = 150; // scoreButton.y = 150
- if (guiPos.x >= scoreButtonX - 150 && guiPos.x <= scoreButtonX + 150 && guiPos.y >= scoreButtonY - 40 && guiPos.y <= scoreButtonY + 40) {
+ // Check score button (SKOR) - center screen, Y offset +150
+ if (x >= 1024 - 150 && x <= 1024 + 150 && y >= 1366 + 150 - 40 && y <= 1366 + 150 + 40) {
// Add visual feedback with tween
tween(scoreButton, {
scaleX: 1.1,
scaleY: 1.1
@@ -589,17 +580,10 @@
}
return;
}
if (showLeaderboard) {
- // Convert click coordinates to GUI coordinates for proper button detection
- var guiPos = LK.gui.center.toLocal({
- x: x,
- y: y
- });
- // Check back button (GERİ) - positioned at GUI center Y + 350 with proper click area
- var backButtonX = 0; // backButton is centered at GUI center (0,0)
- var backButtonY = 350; // backButton.y = 350
- if (guiPos.x >= backButtonX - 150 && guiPos.x <= backButtonX + 150 && guiPos.y >= backButtonY - 40 && guiPos.y <= backButtonY + 40) {
+ // Check back button (GERİ) - center screen, Y offset +350
+ if (x >= 1024 - 150 && x <= 1024 + 150 && y >= 1366 + 350 - 40 && y <= 1366 + 350 + 40) {
// Add visual feedback with tween
tween(backButton, {
scaleX: 1.1,
scaleY: 1.1