User prompt
İncrease distance pipe to pipe
User prompt
İncrease distance pipe to pipe
User prompt
Make everything better ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Add all Real flapy bird thing ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Can you add health bar
User prompt
İncrease distance pipe to pipe
User prompt
Decrase distance of pipe to pipe
User prompt
Add some spacn point
User prompt
Decrease size of pipe to pipe
User prompt
Add coin at among of pipe
User prompt
Reset last adding
User prompt
Make more birde jumping
Code edit (1 edits merged)
Please save this source code
User prompt
Flappy Bird
Initial prompt
Make me flaapy 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.8;
self.flapStrength = -12;
self.maxFallSpeed = 15;
self.rotation = 0;
self.flap = function () {
self.velocity = self.flapStrength;
LK.getSound('flap').play();
// Animate bird rotation for flapping effect
tween(birdGraphics, {
rotation: -0.3
}, {
duration: 100
});
tween(birdGraphics, {
rotation: 0
}, {
duration: 200
});
};
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
if (self.velocity > 0) {
birdGraphics.rotation = Math.min(self.velocity * 0.1, 1.5);
} else {
birdGraphics.rotation = Math.max(self.velocity * 0.1, -0.5);
}
};
return self;
});
var Pipe = Container.expand(function () {
var self = Container.call(this);
self.gapHeight = 300;
self.speed = -4;
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.gapHeight / 2;
self.bottomPipe.y = gapCenterY + self.gapHeight / 2;
};
self.update = function () {
self.x += self.speed;
};
self.checkCollision = function (bird) {
var birdBounds = {
left: bird.x - 30,
right: bird.x + 30,
top: bird.y - 30,
bottom: bird.y + 30
};
var pipeBounds = {
left: self.x - 60,
right: self.x + 60,
topBottom: self.topPipe.y,
bottomTop: self.bottomPipe.y
};
// Check if bird is within pipe horizontal bounds
if (birdBounds.right > pipeBounds.left && birdBounds.left < pipeBounds.right) {
// Check collision with top or bottom pipe
if (birdBounds.top < pipeBounds.topBottom || birdBounds.bottom > pipeBounds.bottomTop) {
return true;
}
}
return false;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var bird;
var birds = []; // Array to hold multiple birds
var pipes = [];
var ground;
var gameStarted = false;
var gameActive = true;
var pipeSpawnTimer = 0;
var pipeSpawnInterval = 90; // 1.5 seconds at 60fps
var birdSpawnTimer = 0;
var birdSpawnInterval = 120; // 2 seconds at 60fps
// Create score display
var scoreTxt = new Text2('0', {
size: 80,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Create start instruction
var startTxt = new Text2('TAP TO START', {
size: 60,
fill: 0xFFFFFF
});
startTxt.anchor.set(0.5, 0.5);
startTxt.x = 2048 / 2;
startTxt.y = 2732 / 2 - 200;
game.addChild(startTxt);
// Initialize bird
bird = new Bird();
bird.x = 2048 / 4;
bird.y = 2732 / 2;
game.addChild(bird);
// Create ground
ground = game.attachAsset('ground', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 2732 - 100
});
function spawnPipe() {
var pipe = new Pipe();
pipe.x = 2048 + 60;
// Random gap center position
var minGapCenter = 200;
var maxGapCenter = 2732 - 200 - 100; // Account for ground
var gapCenterY = minGapCenter + Math.random() * (maxGapCenter - minGapCenter);
pipe.setupPipes(gapCenterY);
pipes.push(pipe);
game.addChild(pipe);
}
function spawnBird() {
var newBird = new Bird();
newBird.x = 2048 / 4 + Math.random() * 200 - 100; // Slight horizontal variation
newBird.y = 200 + Math.random() * (2732 - 400); // Random vertical position
newBird.velocity = Math.random() * 8 - 4; // Random initial velocity
birds.push(newBird);
game.addChild(newBird);
}
function checkScore() {
for (var i = 0; i < pipes.length; i++) {
var pipe = pipes[i];
if (!pipe.scored && pipe.x < bird.x) {
pipe.scored = true;
LK.setScore(LK.getScore() + 1);
scoreTxt.setText(LK.getScore().toString());
LK.getSound('score').play();
}
}
}
function checkCollisions() {
// Check main bird collisions
// Check pipe collisions
for (var i = 0; i < pipes.length; i++) {
if (pipes[i].checkCollision(bird)) {
return true;
}
}
// Check ground collision
if (bird.y + 30 > ground.y) {
return true;
}
// Check ceiling collision
if (bird.y - 30 < 0) {
return true;
}
// Check additional birds collisions (they bounce off obstacles)
for (var j = 0; j < birds.length; j++) {
var extraBird = birds[j];
// Check pipe collisions for extra birds
for (var k = 0; k < pipes.length; k++) {
if (pipes[k].checkCollision(extraBird)) {
extraBird.velocity = -8; // Bounce up
extraBird.flap(); // Make it flap
}
}
// Check ground collision for extra birds
if (extraBird.y + 30 > ground.y) {
extraBird.y = ground.y - 30;
extraBird.velocity = -10; // Bounce up
extraBird.flap();
}
// Check ceiling collision for extra birds
if (extraBird.y - 30 < 0) {
extraBird.y = 30;
extraBird.velocity = 2; // Bounce down slightly
}
}
return false;
}
function gameOver() {
gameActive = false;
LK.getSound('hit').play();
// Stop bird movement
bird.velocity = 0;
// Flash screen red
LK.effects.flashScreen(0xff0000, 1000);
// Show game over after a brief delay
LK.setTimeout(function () {
LK.showGameOver();
}, 500);
}
// Touch/tap handler
game.down = function (x, y, obj) {
if (!gameStarted) {
gameStarted = true;
gameActive = true;
startTxt.visible = false;
// Spawn first pipe
spawnPipe();
// Spawn initial extra birds
spawnBird();
spawnBird();
}
if (gameActive) {
bird.flap();
// Make all extra birds flap too
for (var n = 0; n < birds.length; n++) {
birds[n].flap();
}
}
};
// Main game loop
game.update = function () {
if (!gameStarted || !gameActive) {
return;
}
// Update main bird
bird.update();
// Update additional birds
for (var j = 0; j < birds.length; j++) {
birds[j].update();
}
// Update pipes
for (var i = pipes.length - 1; i >= 0; i--) {
pipes[i].update();
// Remove pipes that have moved off screen
if (pipes[i].x < -120) {
pipes[i].destroy();
pipes.splice(i, 1);
}
}
// Spawn new pipes
pipeSpawnTimer++;
if (pipeSpawnTimer >= pipeSpawnInterval) {
spawnPipe();
pipeSpawnTimer = 0;
}
// Spawn new birds occasionally
birdSpawnTimer++;
if (birdSpawnTimer >= birdSpawnInterval && birds.length < 5) {
spawnBird();
birdSpawnTimer = 0;
}
// Make extra birds randomly flap
for (var m = 0; m < birds.length; m++) {
if (Math.random() < 0.02) {
// 2% chance each frame
birds[m].flap();
}
}
// Check for score
checkScore();
// Check for collisions
if (checkCollisions()) {
gameOver();
}
}; ===================================================================
--- original.js
+++ change.js
@@ -107,14 +107,17 @@
/****
* Game Code
****/
var bird;
+var birds = []; // Array to hold multiple birds
var pipes = [];
var ground;
var gameStarted = false;
var gameActive = true;
var pipeSpawnTimer = 0;
var pipeSpawnInterval = 90; // 1.5 seconds at 60fps
+var birdSpawnTimer = 0;
+var birdSpawnInterval = 120; // 2 seconds at 60fps
// Create score display
var scoreTxt = new Text2('0', {
size: 80,
fill: 0xFFFFFF
@@ -152,8 +155,16 @@
pipe.setupPipes(gapCenterY);
pipes.push(pipe);
game.addChild(pipe);
}
+function spawnBird() {
+ var newBird = new Bird();
+ newBird.x = 2048 / 4 + Math.random() * 200 - 100; // Slight horizontal variation
+ newBird.y = 200 + Math.random() * (2732 - 400); // Random vertical position
+ newBird.velocity = Math.random() * 8 - 4; // Random initial velocity
+ birds.push(newBird);
+ game.addChild(newBird);
+}
function checkScore() {
for (var i = 0; i < pipes.length; i++) {
var pipe = pipes[i];
if (!pipe.scored && pipe.x < bird.x) {
@@ -164,8 +175,9 @@
}
}
}
function checkCollisions() {
+ // Check main bird collisions
// Check pipe collisions
for (var i = 0; i < pipes.length; i++) {
if (pipes[i].checkCollision(bird)) {
return true;
@@ -178,8 +190,30 @@
// Check ceiling collision
if (bird.y - 30 < 0) {
return true;
}
+ // Check additional birds collisions (they bounce off obstacles)
+ for (var j = 0; j < birds.length; j++) {
+ var extraBird = birds[j];
+ // Check pipe collisions for extra birds
+ for (var k = 0; k < pipes.length; k++) {
+ if (pipes[k].checkCollision(extraBird)) {
+ extraBird.velocity = -8; // Bounce up
+ extraBird.flap(); // Make it flap
+ }
+ }
+ // Check ground collision for extra birds
+ if (extraBird.y + 30 > ground.y) {
+ extraBird.y = ground.y - 30;
+ extraBird.velocity = -10; // Bounce up
+ extraBird.flap();
+ }
+ // Check ceiling collision for extra birds
+ if (extraBird.y - 30 < 0) {
+ extraBird.y = 30;
+ extraBird.velocity = 2; // Bounce down slightly
+ }
+ }
return false;
}
function gameOver() {
gameActive = false;
@@ -200,20 +234,31 @@
gameActive = true;
startTxt.visible = false;
// Spawn first pipe
spawnPipe();
+ // Spawn initial extra birds
+ spawnBird();
+ spawnBird();
}
if (gameActive) {
bird.flap();
+ // Make all extra birds flap too
+ for (var n = 0; n < birds.length; n++) {
+ birds[n].flap();
+ }
}
};
// Main game loop
game.update = function () {
if (!gameStarted || !gameActive) {
return;
}
- // Update bird
+ // Update main bird
bird.update();
+ // Update additional birds
+ for (var j = 0; j < birds.length; j++) {
+ birds[j].update();
+ }
// Update pipes
for (var i = pipes.length - 1; i >= 0; i--) {
pipes[i].update();
// Remove pipes that have moved off screen
@@ -227,8 +272,21 @@
if (pipeSpawnTimer >= pipeSpawnInterval) {
spawnPipe();
pipeSpawnTimer = 0;
}
+ // Spawn new birds occasionally
+ birdSpawnTimer++;
+ if (birdSpawnTimer >= birdSpawnInterval && birds.length < 5) {
+ spawnBird();
+ birdSpawnTimer = 0;
+ }
+ // Make extra birds randomly flap
+ for (var m = 0; m < birds.length; m++) {
+ if (Math.random() < 0.02) {
+ // 2% chance each frame
+ birds[m].flap();
+ }
+ }
// Check for score
checkScore();
// Check for collisions
if (checkCollisions()) {
Make bird same like flappy bird. In-Game asset. 2d. No shadows
Make background forest. In-Game asset. 2d. No shadows
Flapy bird coin. In-Game asset. 2d. No shadows
Make it flapy bird cloud. In-Game asset. 2d. High contrast. No shadows
Add a monkey flying with plane. In-Game asset. 2d. No shadows
Make a zombi flapy bird. In-Game asset. 2d. High contrast. No shadows
Make a sigma flapy bird. In-Game asset. 2d. No shadows
Make a star War flapy bird. In-Game asset. 2d. No shadows
Make a gost flapy bird. In-Game asset. 2d. High contrast. No shadows
Make a starting buton. In-Game asset. 2d. High contrast. No shadows
Make a skin buton. In-Game asset. 2d. No shadows
Make it flapy bird building. 2d. No shadows
Make it flapy bird shape. 2d. High contrast. No shadows
Make it flapy bird building. In-Game asset. 2d. No shadows