User prompt
reduce distance between obstacles
User prompt
best score Let him write
User prompt
Let there be a best score in the upper right corner, like a high score ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Let the highest score be in the upper right corner
User prompt
Let there be floating clouds in the background ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
edit the death code according to the current size of the pipes ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
The moment the bird touches the pipes, it dies ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
resize the pipes' measurement value
User prompt
There is an obstacle, you can pass between two pipes, but the obstacle is short, the remaining space is increased, the pipe is too long.
User prompt
delete ground put on screen show
User prompt
Let the ground remain fixed on the front screen
User prompt
move the grass to the front layer and keep it fixed on the screen
User prompt
make the game easier and pass the obstacles more easily
User prompt
Put more ground side by side and let the ground die as soon as it touches you ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Duplicate ground side by side and create like ground and if it touches the ground it will die
User prompt
Increase the distance between the pipes the bird passes through
User prompt
When the pipe is touched, it will die immediately and resize it. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
First pipe obstacle start closer
User prompt
There should be more space between the first pipe obstacle and the second obstacle it will pass through.
User prompt
Let there be more space between the first and second obstacles, 3 times or 2 times
User prompt
Let there be more space between the obstacles he passes through
User prompt
When you press the screen you jump more
User prompt
Make the bird jump higher when you tap the screen
Code edit (1 edits merged)
Please save this source code
User prompt
Flappy Bird
/**** * 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.6; self.flapStrength = -16; self.maxVelocity = 15; self.flap = function () { self.velocity = self.flapStrength; LK.getSound('flap').play(); // Animation for flap tween(birdGraphics, { rotation: -0.5 }, { duration: 150 }); tween(birdGraphics, { rotation: 0 }, { duration: 300 }); }; self.update = function () { // Apply gravity self.velocity += self.gravity; // Limit velocity if (self.velocity > self.maxVelocity) { self.velocity = self.maxVelocity; } // Update position self.y += self.velocity; // Rotate bird based on velocity var targetRotation = Math.min(Math.max(self.velocity * 0.1, -0.5), 1.5); birdGraphics.rotation = targetRotation; }; return self; }); var Pipe = Container.expand(function () { var self = Container.call(this); self.speed = -4; self.gapSize = 400; self.scored = false; // Create top pipe self.topPipe = self.attachAsset('pipe', { anchorX: 0.5, anchorY: 1 }); // Create bottom pipe self.bottomPipe = self.attachAsset('pipe', { anchorX: 0.5, anchorY: 0 }); self.setupPipes = function (gapCenterY) { self.topPipe.y = gapCenterY - self.gapSize / 2; self.bottomPipe.y = 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 pipeSpawnTimer = 0; var pipeSpawnDelay = 150; // frames between pipe spawns var initialPipeSpawnDelay = 60; // frames until first pipe spawns // UI elements var scoreTxt = new Text2('0', { size: 80, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var instructionTxt = new Text2('TAP TO FLAP', { size: 60, fill: 0xFFFFFF }); instructionTxt.anchor.set(0.5, 0.5); instructionTxt.x = 2048 / 2; instructionTxt.y = 2732 / 2 + 200; game.addChild(instructionTxt); // Create bird bird = game.addChild(new Bird()); bird.x = 400; bird.y = 2732 / 2; // Create ground - duplicated side by side for continuous ground var groundTiles = []; for (var i = 0; i < 3; i++) { var groundTile = game.addChild(LK.getAsset('ground', { anchorX: 0, anchorY: 1 })); groundTile.x = i * 291; // Position tiles side by side based on ground width groundTile.y = 2732; groundTiles.push(groundTile); } ground = groundTiles[0]; // Keep reference to first tile for backward compatibility function startGame() { gameStarted = true; instructionTxt.visible = false; bird.flap(); } function spawnPipe() { var pipe = new Pipe(); var minY = 400; var maxY = 2732 - 400; var gapCenterY = minY + Math.random() * (maxY - minY); pipe.x = 2048 + 60; pipe.setupPipes(gapCenterY); pipes.push(pipe); game.addChild(pipe); } function checkCollisions() { // Check ground collision - check against all ground tiles for (var g = 0; g < groundTiles.length; g++) { if (bird.y + 30 >= groundTiles[g].y) { return true; } } // Check ceiling collision if (bird.y - 30 <= 0) { return true; } // Check pipe collisions for (var i = 0; i < pipes.length; i++) { var pipe = pipes[i]; // Simple collision detection with pipes var birdLeft = bird.x - 30; var birdRight = bird.x + 30; var birdTop = bird.y - 22; var birdBottom = bird.y + 22; var pipeLeft = pipe.x - 60; var pipeRight = pipe.x + 60; if (birdRight > pipeLeft && birdLeft < pipeRight) { // Bird is within pipe's horizontal bounds var topPipeBottom = pipe.topPipe.y; var bottomPipeTop = pipe.bottomPipe.y; if (birdTop < topPipeBottom || birdBottom > bottomPipeTop) { return true; } } // Check if bird touches pipe - immediate death with resize effect if (bird.intersects(pipe.topPipe) || bird.intersects(pipe.bottomPipe)) { // Resize pipe with tween effect tween(pipe.topPipe, { scaleX: 1.2, scaleY: 1.2 }, { duration: 200 }); tween(pipe.bottomPipe, { scaleX: 1.2, scaleY: 1.2 }, { duration: 200 }); return true; } } return false; } function updateScore() { for (var i = 0; i < pipes.length; i++) { var pipe = pipes[i]; if (!pipe.scored && bird.x > pipe.x + 60) { pipe.scored = true; LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore()); LK.getSound('score').play(); } } } function cleanupPipes() { for (var i = pipes.length - 1; i >= 0; i--) { var pipe = pipes[i]; if (pipe.x < -120) { pipe.destroy(); pipes.splice(i, 1); } } } // Input handling game.down = function (x, y, obj) { if (!gameStarted) { startGame(); } else if (!gameOver) { bird.flap(); } }; // Main game loop game.update = function () { if (!gameStarted || gameOver) { return; } // Update bird bird.update(); // Spawn pipes pipeSpawnTimer++; var currentDelay = pipes.length === 0 ? initialPipeSpawnDelay : pipeSpawnDelay; if (pipeSpawnTimer >= currentDelay) { spawnPipe(); pipeSpawnTimer = 0; } // Update pipes for (var i = 0; i < pipes.length; i++) { pipes[i].update(); } // Update ground tiles - scroll ground for (var g = 0; g < groundTiles.length; g++) { groundTiles[g].x -= 2; // Move ground at half pipe speed // Reset ground position when it goes off screen if (groundTiles[g].x <= -291) { groundTiles[g].x = (groundTiles.length - 1) * 291; } } // Check collisions if (checkCollisions()) { gameOver = true; LK.getSound('hit').play(); LK.showGameOver(); return; } // Update score updateScore(); // Cleanup off-screen pipes cleanupPipes(); };
===================================================================
--- original.js
+++ change.js
@@ -87,9 +87,9 @@
var ground;
var gameStarted = false;
var gameOver = false;
var pipeSpawnTimer = 0;
-var pipeSpawnDelay = 200; // frames between pipe spawns
+var pipeSpawnDelay = 150; // frames between pipe spawns
var initialPipeSpawnDelay = 60; // frames until first pipe spawns
// UI elements
var scoreTxt = new Text2('0', {
size: 80,
@@ -108,15 +108,20 @@
// Create bird
bird = game.addChild(new Bird());
bird.x = 400;
bird.y = 2732 / 2;
-// Create ground
-ground = game.addChild(LK.getAsset('ground', {
- anchorX: 0,
- anchorY: 1
-}));
-ground.x = 0;
-ground.y = 2732;
+// Create ground - duplicated side by side for continuous ground
+var groundTiles = [];
+for (var i = 0; i < 3; i++) {
+ var groundTile = game.addChild(LK.getAsset('ground', {
+ anchorX: 0,
+ anchorY: 1
+ }));
+ groundTile.x = i * 291; // Position tiles side by side based on ground width
+ groundTile.y = 2732;
+ groundTiles.push(groundTile);
+}
+ground = groundTiles[0]; // Keep reference to first tile for backward compatibility
function startGame() {
gameStarted = true;
instructionTxt.visible = false;
bird.flap();
@@ -131,11 +136,13 @@
pipes.push(pipe);
game.addChild(pipe);
}
function checkCollisions() {
- // Check ground collision
- if (bird.y + 30 >= ground.y) {
- return true;
+ // Check ground collision - check against all ground tiles
+ for (var g = 0; g < groundTiles.length; g++) {
+ if (bird.y + 30 >= groundTiles[g].y) {
+ return true;
+ }
}
// Check ceiling collision
if (bird.y - 30 <= 0) {
return true;
@@ -223,8 +230,16 @@
// Update pipes
for (var i = 0; i < pipes.length; i++) {
pipes[i].update();
}
+ // Update ground tiles - scroll ground
+ for (var g = 0; g < groundTiles.length; g++) {
+ groundTiles[g].x -= 2; // Move ground at half pipe speed
+ // Reset ground position when it goes off screen
+ if (groundTiles[g].x <= -291) {
+ groundTiles[g].x = (groundTiles.length - 1) * 291;
+ }
+ }
// Check collisions
if (checkCollisions()) {
gameOver = true;
LK.getSound('hit').play();
Fullscreen modern App Store landscape banner, 16:9, high definition, for a game titled "Flappy Bird" and with the description "Control a bird through pipe obstacles by tapping to flap and avoid crashing. Simple controls, challenging gameplay.". No text on banner!
vertical long pipe. In-Game asset. 2d. High contrast. No shadows
cloudy. In-Game asset. 2d. High contrast. No shadows