User prompt
After score even 50 make sure none of the pipes shouldnt be impossible to pass maybe we can do %1 easier after 50 till 50 everything is ok
User prompt
Start my score from 45 for test purposes
User prompt
make %4-5 less extreme for make vertical extreme in later on the game score around 50+ make %2-3 more extreme
User prompt
Biraz daha arttır gap position randomness make vertical movement little bit more extreme
User prompt
Pipe spawnını aniden en alttan en üste çekme biraz daha yakınlaştır kuş zor olsada yetişebilsin ama çokta kolaylaştırma
User prompt
Pipe spawnını biraz daha zorlaştır şuan çok kolay
User prompt
Pipeların boşluğunu yetişebileceğimiz şekilde derecelendir bir anda en yüksekten en aşağıya geçişlerde bazen geçmek imkansız olabiliyor bunları kuşun hızına göre ölç ayarla
User prompt
Her 30 puanda bir arka plan asseti değişsin toplamda 3 farklı asset olabilir
User prompt
Pipeların üstleri ve altları tamamen ekranın üstüne altına gelsin boşluk sadece pipeların arasında kalsın
User prompt
Pipelar tamamen oyun ekranına sığdırılsın alttan ve üstten boşluk kalmasın
User prompt
Pipe'ların içinden geçiş kolaylaşması adına aralıkları genişlesin
Code edit (1 edits merged)
Please save this source code
User prompt
Flappy Bird - Tap to Fly
Initial prompt
Flappy Bird oyunu
/**** * 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.5; self.flapPower = -10; self.maxFallSpeed = 10; self.rotation = 0; self.flap = function () { self.velocity = self.flapPower; LK.getSound('flap').play(); // Animate bird flap tween(birdGraphics, { rotation: -0.3 }, { duration: 150, easing: tween.easeOut }); tween(birdGraphics, { rotation: 0 }, { duration: 300, easing: tween.easeInOut }); }; self.update = function () { // Apply gravity self.velocity += self.gravity; // Limit fall speed if (self.velocity > self.maxFallSpeed) { self.velocity = self.maxFallSpeed; } // Update position self.y += self.velocity; // Rotate bird based on velocity var targetRotation = Math.min(Math.PI / 4, self.velocity * 0.05); birdGraphics.rotation = targetRotation; }; return self; }); var Pipe = Container.expand(function () { var self = Container.call(this); self.speed = -4; self.gapSize = 400; self.passed = false; var topPipe = self.attachAsset('pipeTop', { anchorX: 0.5, anchorY: 1 }); var bottomPipe = self.attachAsset('pipeBottom', { anchorX: 0.5, anchorY: 0 }); self.setGapPosition = function (gapY) { // Position top pipe so it extends from screen top (0) to gap // Top pipe anchored at bottom (anchorY: 1), so y position is where bottom edge should be topPipe.y = gapY - self.gapSize / 2; // Position bottom pipe so it extends from gap to screen bottom (2732) // Bottom pipe anchored at top (anchorY: 0), so y position is where top edge should be bottomPipe.y = gapY + self.gapSize / 2; }; self.update = function () { self.x += self.speed; }; self.checkCollision = function (bird) { var birdBounds = { x: bird.x - 30, y: bird.y - 30, width: 60, height: 60 }; var topPipeBounds = { x: self.x - 60, y: topPipe.y - 2732, width: 120, height: 2732 }; var bottomPipeBounds = { x: self.x - 60, y: bottomPipe.y, width: 120, height: 2732 }; return self.intersectsBounds(birdBounds, topPipeBounds) || self.intersectsBounds(birdBounds, bottomPipeBounds); }; self.intersectsBounds = function (a, b) { return a.x < b.x + b.width && a.x + a.width > b.x && a.y < b.y + b.height && a.y + a.height > b.y; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ // Game state var gameStarted = false; var bird; var pipes = []; var ground; var pipeSpawnTimer = 0; var pipeSpawnDelay = 120; // 2 seconds at 60fps var currentBackgroundLevel = 0; var background; // Create background background = game.addChild(LK.getAsset('background1', { anchorX: 0, anchorY: 0 })); background.x = 0; background.y = 0; // Create bird bird = game.addChild(new Bird()); bird.x = 400; bird.y = 1366; // Center of screen // Create ground ground = game.addChild(LK.getAsset('ground', { anchorX: 0, anchorY: 0 })); ground.x = 0; ground.y = 2732 - 100; // Set initial score to 45 for testing LK.setScore(45); // Create score display var scoreTxt = new Text2('45', { size: 120, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); scoreTxt.y = 100; // Create instruction text var instructionTxt = new Text2('TAP TO FLY', { size: 80, fill: 0xFFFFFF }); instructionTxt.anchor.set(0.5, 0.5); game.addChild(instructionTxt); instructionTxt.x = 1024; instructionTxt.y = 800; // Spawn pipe function function spawnPipe() { var pipe = new Pipe(); var minY = 600; var maxY = 2132; var totalRange = maxY - minY; var currentScore = LK.getScore(); var randomnessMultiplier; // Adjust randomness based on score if (currentScore < 50) { // Early game: 4-5% less extreme (reduce range by ~20-25%) randomnessMultiplier = 0.75; } else { // Late game (50+): 2-3% more extreme but 1% easier to prevent impossible pipes randomnessMultiplier = 1.14; } var adjustedRange = totalRange * randomnessMultiplier; var rangeOffset = (totalRange - adjustedRange) / 2; var adjustedMinY = minY + rangeOffset; var adjustedMaxY = maxY - rangeOffset; var gapY = adjustedMinY + Math.random() * adjustedRange; pipe.setGapPosition(gapY); pipe.x = 2048 + 60; pipes.push(pipe); game.addChild(pipe); } // Game input handling game.down = function (x, y, obj) { if (!gameStarted) { gameStarted = true; instructionTxt.visible = false; spawnPipe(); } bird.flap(); }; // Main game loop game.update = function () { if (!gameStarted) return; // Update bird bird.update(); // Check bird boundaries if (bird.y <= 0 || bird.y >= ground.y - 30) { // Hit ceiling or ground LK.getSound('hit').play(); LK.showGameOver(); return; } // Spawn pipes pipeSpawnTimer++; if (pipeSpawnTimer >= pipeSpawnDelay) { spawnPipe(); pipeSpawnTimer = 0; } // Update pipes for (var i = pipes.length - 1; i >= 0; i--) { var pipe = pipes[i]; pipe.update(); // Check collision if (pipe.checkCollision(bird)) { LK.getSound('hit').play(); LK.showGameOver(); return; } // Check if bird passed pipe if (!pipe.passed && bird.x > pipe.x) { pipe.passed = true; LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore()); LK.getSound('score').play(); // Change background every 30 points var newBackgroundLevel = Math.floor(LK.getScore() / 30); if (newBackgroundLevel !== currentBackgroundLevel && newBackgroundLevel < 3) { currentBackgroundLevel = newBackgroundLevel; var backgroundAssets = ['background1', 'background2', 'background3']; background.destroy(); background = game.addChild(LK.getAsset(backgroundAssets[currentBackgroundLevel], { anchorX: 0, anchorY: 0 })); background.x = 0; background.y = 0; // Move background to back game.setChildIndex(background, 0); } } // Remove pipes that are off screen if (pipe.x < -120) { pipe.destroy(); pipes.splice(i, 1); } } };
===================================================================
--- original.js
+++ change.js
@@ -168,10 +168,10 @@
if (currentScore < 50) {
// Early game: 4-5% less extreme (reduce range by ~20-25%)
randomnessMultiplier = 0.75;
} else {
- // Late game (50+): 2-3% more extreme (increase range by ~10-15%)
- randomnessMultiplier = 1.15;
+ // Late game (50+): 2-3% more extreme but 1% easier to prevent impossible pipes
+ randomnessMultiplier = 1.14;
}
var adjustedRange = totalRange * randomnessMultiplier;
var rangeOffset = (totalRange - adjustedRange) / 2;
var adjustedMinY = minY + rangeOffset;