User prompt
If flappy touch the ground he will out
User prompt
Make score on the upper side and the score will shows number and the number will increasing by time of gameplay
User prompt
Remove stones
User prompt
Spawn stones in random position
User prompt
Decrease the size of flappy 1.5×
User prompt
Increase the size of flappy 3×
User prompt
Remove trees
User prompt
On the upper side make sky
User prompt
Increase size of trees 2×
User prompt
Trees wikl apear on only base
User prompt
Increase size of trees
User prompt
Increase the number of trees increase the size of trees and trees
User prompt
Make trees everywhere
User prompt
Add some trees in background
User prompt
Make some trees
User prompt
The background of game make grass
Initial prompt
Flappy bird
/**** * Classes ****/ //<Assets used in the game will automatically appear here> // Flappy class representing the player character var Flappy = Container.expand(function () { var self = Container.call(this); var flappyGraphics = self.attachAsset('flappy', { anchorX: 0.5, anchorY: 0.5, scaleX: 2.0, scaleY: 2.0 }); self.gravity = 0.5; self.lift = -10; self.velocity = 0; self.jump = function () { self.velocity = self.lift; }; self.update = function () { self.velocity += self.gravity; self.y += self.velocity; if (self.y > 2732 - flappyGraphics.height / 2) { self.y = 2732 - flappyGraphics.height / 2; self.velocity = 0; } if (self.y < flappyGraphics.height / 2) { self.y = flappyGraphics.height / 2; self.velocity = 0; } }; }); // Pipe class representing the obstacles var Pipe = Container.expand(function () { var self = Container.call(this); var pipeGraphics = self.attachAsset('pipe', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -5; self.update = function () { self.x += self.speed; if (self.x < -pipeGraphics.width / 2) { self.destroy(); } }; }); // Sky class representing the sky var Sky = Container.expand(function () { var self = Container.call(this); var skyGraphics = self.attachAsset('sky', { anchorX: 0.5, anchorY: 0.5, scaleX: 2.0, scaleY: 2.0 }); self.update = function () { // Sky does not need to update }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB // Init game with sky blue background }); /**** * Game Code ****/ var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var sky = game.addChild(new Sky()); sky.x = 2048 / 2; sky.y = 2732 / 4; var flappy = game.addChild(new Flappy()); flappy.x = 2048 / 4; flappy.y = 2732 / 2; var pipes = []; var pipeInterval = 90; var frameCount = 0; game.down = function (x, y, obj) { flappy.jump(); }; game.update = function () { frameCount++; if (frameCount % pipeInterval === 0) { var pipeTop = new Pipe(); var pipeBottom = new Pipe(); var pipeGap = 400; var pipeHeight = Math.random() * (2732 - pipeGap - 200) + 100; pipeTop.x = 2048; pipeTop.y = pipeHeight / 2; pipeBottom.x = 2048; pipeBottom.y = pipeHeight + pipeGap + pipeHeight / 2; pipes.push(pipeTop); pipes.push(pipeBottom); game.addChild(pipeTop); game.addChild(pipeBottom); } // Removed duplicate tree update loop for (var i = pipes.length - 1; i >= 0; i--) { pipes[i].update(); if (pipes[i].intersects(flappy)) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } } scoreTxt.setText(Math.floor(LK.ticks / 60)); flappy.update(); };
===================================================================
--- original.js
+++ change.js
@@ -68,8 +68,14 @@
/****
* Game Code
****/
+var scoreTxt = new Text2('0', {
+ size: 150,
+ fill: "#ffffff"
+});
+scoreTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreTxt);
var sky = game.addChild(new Sky());
sky.x = 2048 / 2;
sky.y = 2732 / 4;
var flappy = game.addChild(new Flappy());
@@ -104,6 +110,7 @@
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
}
+ scoreTxt.setText(Math.floor(LK.ticks / 60));
flappy.update();
};
\ No newline at end of file