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
User prompt
Oyun ilk açıldığında direkt oyunu başlatma yeri açılmasın. O menüden önce bir menü olsun ve oyuna giriş tuşu olsun, skor tuşumuz olsun gibi gibi.
User prompt
Tüm duvarlar birbirine eşit uzaklıkta olacak yeter artık.
User prompt
İlk iki duvarın bir-birinə uzaqlığı iyi ikən üçüncü duvar ikinci duvara aşırı uzaq.
User prompt
Duvarlar birbirine yani uzaklık olarak ne uzak ne yakın olacak.
User prompt
Oyun kasmasın diye stunları birbirinden uzak yapıyorsan bu kötü birşey. Oyundaki zaten amaç duvarların arasından geçmek. Oyuncuyu oyunda tutmak. O yüzden duvarlar arası uzaklığı eşit yap.
User prompt
İlk İki Duvar Yani İlk İki Skoru Kazanmak Kolayken Üçüncü Skor Yani Üçüncü Duvar Stunu Çok Uzak Aşırı Uzak Bu Stunları Eşit Yap Ve Uzaklıkları Eşit Olsun
User prompt
Tıkla ve oyna yazısına tıklayınca yazı kayboluyor ama arkasındaki renk yani siyah şey kaybolmuyor.
User prompt
Tıkla ve oyna yazısının altına renk koy. Böylece tıkla ve oyna yazısı gözükecek.
User prompt
İlk iki duvar arasında neredeyse hiç boşluk yokken, iki ile üçüncü duvar arasında aşırı uzun bir boşluk var. Orantıyı tuttur.
User prompt
Kuşu hareket ettirdikten sonra rahat bırakıp yere düştüğünü izlerken oyun kasıyor.
User prompt
Duvar aralıqlarını çox dar yapmışsın. Duvarlar arası boşluq yox. Gerçək Flappy Birddən əsinlənərək oyunu təkrar duvarlar arasını genişlət.
User prompt
tamam oyun başlamadığında kuş hareket etmiyor ama kuşu hareket ettirmeye başladığımızda kuşun en son gittiği yerden puan başlıyor yani kuş hareket etmese de dümdüz hareket ediyor ve duvarlardan hasar almıyor kuş hareket etmesin diye sıkıştır
User prompt
Oyun başlamadan önce kuş hareket etmesin diye kuşu bloklar arasına sıkıştır ama bu bloklar bize gözükmesin oyun başladığında bunlar silinsin.
User prompt
oyun başladığında ekranda yazık kalıyor ve duvarlar çok dar
User prompt
Oyundaki tüm kodları her şeyi sil ve baştan yaz.
User prompt
oyundaki tüm duvar kodlarını kontrol et ve tekrar yaz
User prompt
Arasından geçtiklerimizin yukarıdaki yok yani arasından geçmiyoruz üstünden geçiyor oluyoruz Flappy Bird'den örnek alarak oyunu düzelt
User prompt
Arasından geçtiğimiz sütunlar yukarıdakiler silindi ekle ve yukarıdaki en yüksek yere kadar çıksınlar hani ekranda gözüken
User prompt
Arasından Geçtiklerimizi Duvar Olarak Aşağı Ve Yukarıya Orantıla Boşluk Kalmasın Ve En Fazla
User prompt
şu ana kadar yaptığımız hiç kasmayan haline getir
User prompt
Arasından geçtiğimiz stumların kalitesini biraz düşür
User prompt
Her Geçtiğimiz İki Stun'dan Sonra Arkaya Giden Stun'ları Sil Yani Ekranda Gözükmeyen
User prompt
250 ms kapıyı aç
/**** * Plugins ****/ var tween = LK.import("@upit/tween.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 () { 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 = 300; 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 () { 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 gameStarted = false; var gameOver = false; var pipeSpacing = 400; var nextPipeX = 2048; // 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 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; LK.gui.center.addChild(instructionTxt); // Create bird bird = game.addChild(new Bird()); bird.x = 400; bird.y = 1366; // 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 = 400; var maxGapY = 2182; // 2732 - 150 - 400 var gapCenterY = minGapY + Math.random() * (maxGapY - minGapY); var pipe = new Pipe(gapCenterY); pipe.x = nextPipeX; pipes.push(pipe); game.addChild(pipe); nextPipeX += pipeSpacing; } // 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 nextPipeX = 2048; gameStarted = false; gameOver = false; LK.setScore(0); scoreTxt.setText('SKOR: 0'); // Show instruction instructionTxt.visible = true; // Create initial pipes createPipe(); createPipe(); } // Initialize game createPipe(); createPipe(); // Touch/click handler game.down = function (x, y, obj) { if (gameOver) { resetGame(); return; } if (!gameStarted) { gameStarted = true; instructionTxt.visible = false; } bird.flap(); }; // Main game loop game.update = function () { if (!gameStarted || gameOver) return; // Check ground collision if (bird.y + 20 >= 2732 - 150) { gameOver = true; LK.showGameOver(); return; } // Check ceiling collision if (bird.y - 20 <= 0) { gameOver = true; LK.showGameOver(); return; } // Check pipe collisions and scoring for (var i = 0; i < pipes.length; i++) { var pipe = pipes[i]; // 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; LK.showGameOver(); return; } // Check collision with bottom pipe if (bird.y + 20 > pipe.gapCenterY + pipe.gapSize / 2) { gameOver = true; LK.showGameOver(); return; } } // Check scoring 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 if (pipes.length === 0 || nextPipeX - pipes[pipes.length - 1].x >= pipeSpacing) { createPipe(); } // Remove off-screen pipes for (var j = pipes.length - 1; j >= 0; j--) { if (pipes[j].x < -100) { pipes[j].destroy(); pipes.splice(j, 1); } } };
===================================================================
--- original.js
+++ change.js
@@ -1,63 +1,58 @@
/****
* 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);
- // Create simple bird with single asset for better performance
- var birdBody = self.attachAsset('bird', {
+ var birdGraphics = self.attachAsset('bird', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocity = 0;
- self.gravity = 0.6;
- self.jumpStrength = -11;
- self.lastY = 0;
+ self.gravity = 0.8;
+ self.jumpStrength = -12;
self.flap = function () {
self.velocity = self.jumpStrength;
LK.getSound('flap').play();
};
self.update = function () {
self.velocity += self.gravity;
self.y += self.velocity;
- // Simple rotation based on velocity - reduced calculation frequency
- if (LK.ticks % 3 === 0) {
- birdBody.rotation = Math.max(-0.4, Math.min(1.2, self.velocity * 0.08));
+ // 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 (isTop, gapY) {
+var Pipe = Container.expand(function (gapCenterY) {
var self = Container.call(this);
- // Create pipe graphics
- var pipeGraphics = self.attachAsset('pipe', {
+ self.gapSize = 300;
+ self.speed = -3;
+ self.passed = false;
+ self.gapCenterY = gapCenterY;
+ // Create top pipe
+ var topPipe = self.attachAsset('pipe', {
anchorX: 0.5,
- anchorY: isTop ? 1 : 0
+ anchorY: 1
});
- self.speed = -4;
- self.passed = false;
- self.isTop = isTop;
- self.gapY = gapY;
- // Position and scale pipes to create proper walls
- if (isTop) {
- // Top pipe extends from screen top to gap start
- var topWallHeight = gapY - gapSize / 2;
- pipeGraphics.height = topWallHeight;
- self.y = 0; // Start from very top
- } else {
- // Bottom pipe extends from gap end to ground
- var bottomWallHeight = 2532 - (gapY + gapSize / 2);
- pipeGraphics.height = bottomWallHeight;
- self.y = gapY + gapSize / 2; // Start from gap end
- }
+ 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 () {
- // Move pipe to the left
self.x += self.speed;
};
return self;
});
@@ -71,60 +66,35 @@
/****
* Game Code
****/
+// Game variables
var bird;
var pipes = [];
var ground;
-var gameSpeed = 4;
-var gapSize = 500; // Further increased gap size for much easier gameplay
-var pipeSpacing = 500; // Increased spacing for better playability
-var nextPipeX = 2048;
var gameStarted = false;
var gameOver = false;
-var gameWaitingForRestart = false;
-var highScore = storage.highScore || 0;
-// Create score display with better visibility
+var pipeSpacing = 400;
+var nextPipeX = 2048;
+// Create score display
var scoreTxt = new Text2('SKOR: 0', {
- size: 70,
+ size: 80,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
-LK.gui.top.addChild(scoreTxt);
-scoreTxt.y = 80;
-// Add text stroke for better visibility
scoreTxt.stroke = 0x000000;
scoreTxt.strokeThickness = 4;
-// Create game over display elements with better visibility
-var gameOverTxt = new Text2('OYUN BİTTİ!', {
- size: 90,
- fill: 0xFF0000
-});
-gameOverTxt.anchor.set(0.5, 0.5);
-gameOverTxt.visible = false;
-gameOverTxt.stroke = 0xFFFFFF;
-gameOverTxt.strokeThickness = 5;
-LK.gui.center.addChild(gameOverTxt);
-var currentScoreTxt = new Text2('', {
+LK.gui.top.addChild(scoreTxt);
+scoreTxt.y = 100;
+// Create instruction text
+var instructionTxt = new Text2('TIKLA VE OYNA!', {
size: 60,
fill: 0xFFFFFF
});
-currentScoreTxt.anchor.set(0.5, 0.5);
-currentScoreTxt.visible = false;
-currentScoreTxt.stroke = 0x000000;
-currentScoreTxt.strokeThickness = 3;
-LK.gui.center.addChild(currentScoreTxt);
-currentScoreTxt.y = 100;
-var highScoreTxt = new Text2('', {
- size: 60,
- fill: 0xFFD700
-});
-highScoreTxt.anchor.set(0.5, 0.5);
-highScoreTxt.visible = false;
-highScoreTxt.stroke = 0x000000;
-highScoreTxt.strokeThickness = 3;
-LK.gui.center.addChild(highScoreTxt);
-highScoreTxt.y = 180;
+instructionTxt.anchor.set(0.5, 0.5);
+instructionTxt.stroke = 0x000000;
+instructionTxt.strokeThickness = 3;
+LK.gui.center.addChild(instructionTxt);
// Create bird
bird = game.addChild(new Bird());
bird.x = 400;
bird.y = 1366;
@@ -134,55 +104,25 @@
anchorY: 1
}));
ground.x = 0;
ground.y = 2732;
-// Create grass layer on ground
-var grass = game.addChild(LK.getAsset('groundTop', {
- anchorX: 0,
- anchorY: 1
-}));
-grass.x = 0;
-grass.y = 2532;
-// Create static decorative clouds for better performance
-var clouds = [];
-for (var c = 0; c < 2; c++) {
- var cloud = game.addChild(LK.getAsset('cloud', {
- anchorX: 0.5,
- anchorY: 0.5
- }));
- cloud.x = Math.random() * 2048;
- cloud.y = 300 + Math.random() * 400;
- cloud.alpha = 0.5;
- clouds.push(cloud);
-}
-function createPipePair() {
- // Calculate gap position within safe bounds
- var minGapY = 400; // Minimum distance from top
- var maxGapY = 2132; // Maximum distance from bottom (2532 - 400)
- var gapY = minGapY + Math.random() * (maxGapY - minGapY);
- // Create top wall pipe
- var topPipe = new Pipe(true, gapY);
- topPipe.x = nextPipeX;
- pipes.push(topPipe);
- game.addChild(topPipe);
- // Create bottom wall pipe
- var bottomPipe = new Pipe(false, gapY);
- bottomPipe.x = nextPipeX;
- pipes.push(bottomPipe);
- game.addChild(bottomPipe);
+// Create pipe function
+function createPipe() {
+ var minGapY = 400;
+ var maxGapY = 2182; // 2732 - 150 - 400
+ var gapCenterY = minGapY + Math.random() * (maxGapY - minGapY);
+ var pipe = new Pipe(gapCenterY);
+ pipe.x = nextPipeX;
+ pipes.push(pipe);
+ game.addChild(pipe);
nextPipeX += pipeSpacing;
}
+// Reset game function
function resetGame() {
// Reset bird
bird.x = 400;
bird.y = 1366;
bird.velocity = 0;
- bird.lastY = bird.y;
- bird.wingState = 0;
- // Reset bird visual state - simplified for single asset bird
- if (bird.children[0]) {
- bird.children[0].rotation = 0; // Reset body rotation
- }
// Clear pipes
for (var i = pipes.length - 1; i >= 0; i--) {
pipes[i].destroy();
}
@@ -190,123 +130,80 @@
// Reset variables
nextPipeX = 2048;
gameStarted = false;
gameOver = false;
- gameWaitingForRestart = false;
- lastBirdY = bird.y;
- lastFlapTime = 0;
- gameSpeed = 4;
LK.setScore(0);
scoreTxt.setText('SKOR: 0');
- // Hide game over display elements
- gameOverTxt.visible = false;
- currentScoreTxt.visible = false;
- highScoreTxt.visible = false;
+ // Show instruction
+ instructionTxt.visible = true;
// Create initial pipes
- createPipePair();
- createPipePair();
+ createPipe();
+ createPipe();
}
-// Initialize first pipes
-createPipePair();
-createPipePair();
-function showGameOverScreen() {
- var currentScore = LK.getScore();
- // Update high score if needed
- if (currentScore > highScore) {
- highScore = currentScore;
- storage.highScore = highScore;
- }
- // Show game over display
- gameOverTxt.visible = true;
- currentScoreTxt.setText('SKOR: ' + currentScore);
- currentScoreTxt.visible = true;
- highScoreTxt.setText('EN YÜKSEK SKOR: ' + highScore);
- highScoreTxt.visible = true;
- // Set waiting for restart state and show game over screen
- gameWaitingForRestart = true;
- gameOver = true;
- LK.showGameOver();
-}
-var lastFlapTime = 0;
-var flapCooldown = 250; // Quarter second delay between flaps in milliseconds
+// Initialize game
+createPipe();
+createPipe();
+// Touch/click handler
game.down = function (x, y, obj) {
- // Handle restart after game over
- if (gameWaitingForRestart) {
+ if (gameOver) {
resetGame();
return;
}
- if (gameOver) return; // Ignore clicks when game is over
- var currentTime = Date.now();
- if (currentTime - lastFlapTime < flapCooldown) return; // Debounce rapid clicks with increased delay
if (!gameStarted) {
gameStarted = true;
+ instructionTxt.visible = false;
}
bird.flap();
- lastFlapTime = currentTime;
};
+// Main game loop
game.update = function () {
- if (!gameStarted || gameOver || gameWaitingForRestart) return;
- // Check if bird hits ground (immediate detection with proper hitbox)
- // Ground is positioned at y=2732 with height 200, so ground surface is at y=2532
- if (bird.y + 30 >= 2532) {
+ if (!gameStarted || gameOver) return;
+ // Check ground collision
+ if (bird.y + 20 >= 2732 - 150) {
gameOver = true;
- showGameOverScreen();
+ LK.showGameOver();
return;
}
- // Check if bird goes too high
- if (bird.y < 50) {
- if (!gameOver) {
- gameOver = true;
- showGameOverScreen();
- }
+ // Check ceiling collision
+ if (bird.y - 20 <= 0) {
+ gameOver = true;
+ LK.showGameOver();
return;
}
- // Check collision with walls
- for (var i = 0; i < pipes.length; i += 2) {
- var topPipe = pipes[i];
- var bottomPipe = pipes[i + 1];
- // Skip pipes that are too far away
- if (topPipe.x < bird.x - 100 || topPipe.x > bird.x + 100) continue;
- // Check if bird is horizontally within pipe walls
- if (bird.x + 40 > topPipe.x - 60 && bird.x - 40 < topPipe.x + 60) {
- // Check collision with top wall
- var topWallBottom = topPipe.gapY - gapSize / 2;
- if (bird.y - 30 <= topWallBottom) {
+ // Check pipe collisions and scoring
+ for (var i = 0; i < pipes.length; i++) {
+ var pipe = pipes[i];
+ // 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;
- showGameOverScreen();
+ LK.showGameOver();
return;
}
- // Check collision with bottom wall
- var bottomWallTop = bottomPipe.gapY + gapSize / 2;
- if (bird.y + 30 >= bottomWallTop) {
+ // Check collision with bottom pipe
+ if (bird.y + 20 > pipe.gapCenterY + pipe.gapSize / 2) {
gameOver = true;
- showGameOverScreen();
+ LK.showGameOver();
return;
}
}
- // Scoring check - bird successfully passed through gap
- if (!topPipe.passed && topPipe.x < bird.x - 60) {
- topPipe.passed = true;
- bottomPipe.passed = true;
+ // Check scoring
+ 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 when needed
+ // Create new pipes
if (pipes.length === 0 || nextPipeX - pipes[pipes.length - 1].x >= pipeSpacing) {
- createPipePair();
+ createPipe();
}
- // Clean up wall pairs that are far off-screen
- if (LK.ticks % 300 === 0 && pipes.length > 6) {
- for (var removeIndex = 0; removeIndex < pipes.length; removeIndex += 2) {
- var topWall = pipes[removeIndex];
- var bottomWall = pipes[removeIndex + 1];
- if (topWall && topWall.x < -300) {
- topWall.destroy(); // Remove top wall
- bottomWall.destroy(); // Remove bottom wall
- pipes.splice(removeIndex, 2); // Remove both from array
- break;
- }
+ // Remove off-screen pipes
+ for (var j = pipes.length - 1; j >= 0; j--) {
+ if (pipes[j].x < -100) {
+ pipes[j].destroy();
+ pipes.splice(j, 1);
}
}
};
\ No newline at end of file