User prompt
Elements after left side screen despawn itself
User prompt
Add particle effect of fire in back of the bird
User prompt
Bg size = gameplay screen
User prompt
Link background with Bg assets
User prompt
Increase spawn rate of pipes
User prompt
Background colour black
Code edit (3 edits merged)
Please save this source code
User prompt
Increase speed
Code edit (1 edits merged)
Please save this source code
Initial prompt
Flappy bird
/**** * Classes ****/ //<Assets used in the game will automatically appear here> // Bird class var Bird = Container.expand(function () { var self = Container.call(this); var birdGraphics = self.attachAsset('bird', { anchorX: 0.5, anchorY: 0.5 }); self.gravity = 0.5; self.lift = -15; self.velocity = 0; self.flap = function () { self.velocity = self.lift; }; self.update = function () { self.velocity += self.gravity; self.y += self.velocity; if (self.y > 2732) { self.y = 2732; self.velocity = 0; LK.showGameOver(); } if (self.y < 0) { self.y = 0; self.velocity = 0; } }; return self; }); // Coin class var Coin = Container.expand(function () { var self = Container.call(this); var coinGraphics = self.attachAsset('coin', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -8; self.update = function () { self.x += self.speed; if (self.x < -coinGraphics.width) { self.destroy(); } }; return self; }); // Pipe class var Pipe = Container.expand(function () { var self = Container.call(this); var pipeGraphics = self.attachAsset('pipe', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -8; self.update = function () { self.x += self.speed; if (self.x < -pipeGraphics.width) { self.destroy(); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB // Sky blue background }); /**** * Game Code ****/ var bird = game.addChild(new Bird()); bird.x = 2048 / 4; bird.y = 2732 / 2; var pipes = []; var coins = []; var score = 0; var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); function spawnPipe() { var gap = 400; var topPipeHeight = Math.random() * (2732 - gap); var bottomPipeHeight = 2732 - topPipeHeight - gap; var topPipe = new Pipe(); topPipe.x = 2048; topPipe.y = topPipeHeight / 2; pipes.push(topPipe); game.addChild(topPipe); var bottomPipe = new Pipe(); bottomPipe.x = 2048; bottomPipe.y = 2732 - bottomPipeHeight / 2; pipes.push(bottomPipe); game.addChild(bottomPipe); } function spawnCoin() { var coin = new Coin(); coin.x = 2048; coin.y = Math.random() * 2732; coins.push(coin); game.addChild(coin); } game.down = function (x, y, obj) { bird.flap(); }; game.update = function () { bird.update(); for (var i = pipes.length - 1; i >= 0; i--) { pipes[i].update(); if (pipes[i].intersects(bird)) { LK.showGameOver(); } } for (var j = coins.length - 1; j >= 0; j--) { coins[j].update(); if (coins[j].intersects(bird)) { score += 1; scoreTxt.setText(score); coins[j].destroy(); coins.splice(j, 1); } } if (LK.ticks % 90 == 0) { spawnPipe(); } if (LK.ticks % 150 == 0) { spawnCoin(); } };
===================================================================
--- original.js
+++ change.js
@@ -8,10 +8,10 @@
var birdGraphics = self.attachAsset('bird', {
anchorX: 0.5,
anchorY: 0.5
});
- self.gravity = 0.2;
- self.lift = -10;
+ self.gravity = 0.5;
+ self.lift = -15;
self.velocity = 0;
self.flap = function () {
self.velocity = self.lift;
};
@@ -36,9 +36,9 @@
var coinGraphics = self.attachAsset('coin', {
anchorX: 0.5,
anchorY: 0.5
});
- self.speed = -5;
+ self.speed = -8;
self.update = function () {
self.x += self.speed;
if (self.x < -coinGraphics.width) {
self.destroy();
@@ -52,9 +52,9 @@
var pipeGraphics = self.attachAsset('pipe', {
anchorX: 0.5,
anchorY: 0.5
});
- self.speed = -5;
+ self.speed = -8;
self.update = function () {
self.x += self.speed;
if (self.x < -pipeGraphics.width) {
self.destroy();
Spikes. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Gold coin write I on center of the coin. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A 2d war symmetrical landscape low Polly. Single Game Texture. In-Game asset. 2d. Blank background. No shadows.
Fire partical trail. Single Game Texture. In-Game asset. 2d. Blank background. No shadows.