User prompt
Add pillers on top . Ground . In midle
User prompt
Make bird jump haight
User prompt
Make hard
User prompt
Add pillars insted of wall
User prompt
Game over when we touch the top
User prompt
Game over if we toch the wall
User prompt
Do the namber increasing
User prompt
Sloaw the speed of faling of bird
User prompt
Add flapping sound
User prompt
Make nambur incresing
Code edit (1 edits merged)
Please save this source code
User prompt
Add wall
User prompt
Spawn the bird on the topest haight
User prompt
When the game start don t spawn bird on low g
User prompt
Spawn the bird on the top
User prompt
Spawn the bird on more haight
User prompt
When game start and player out then appear game over don t appear game over in start interface
User prompt
Make interface and add start botten in interface
User prompt
Make when the game start the was in the air and make ground someone toche the grond out him
User prompt
Remove pipes
User prompt
Make pipe lenth 100
User prompt
Add sun
User prompt
Change sky colure to blue
User prompt
Make pipe larger and only space for bird an add wals in grond
/****
* 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.velocity = 0;
self.gravity = 0.5;
self.flapStrength = -15;
self.update = function () {
self.velocity += self.gravity;
self.y += self.velocity;
if (self.y > 2732 - birdGraphics.height / 2) {
self.y = 2732 - birdGraphics.height / 2;
self.velocity = 0;
}
if (self.y < birdGraphics.height / 2) {
self.y = birdGraphics.height / 2;
self.velocity = 0;
}
};
self.flap = function () {
self.velocity = self.flapStrength;
};
});
// 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 = -5;
self.update = function () {
self.x += self.speed;
if (self.x < -pipeGraphics.width / 2) {
self.destroy();
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB // Init game with sky blue background
});
/****
* Game Code
****/
var ground = LK.getAsset('pipe', {
anchorX: 0.5,
anchorY: 0.5,
width: 2048,
height: 100,
x: 2048 / 2,
y: 2732 - 50
});
game.addChild(ground);
var ceiling = LK.getAsset('pipe', {
anchorX: 0.5,
anchorY: 0.5,
width: 2048,
height: 100,
x: 2048 / 2,
y: 50
});
game.addChild(ceiling);
var sky = LK.getAsset('sky', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2
});
game.addChild(sky);
var cloud = LK.getAsset('cloud', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 4
});
game.addChild(cloud);
var bird = game.addChild(new Bird());
bird.x = 2048 / 4;
bird.y = 2732 / 2;
var pipes = [];
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 = 200;
var pipeHeight = 600;
var pipeY = Math.random() * (2732 - gap - pipeHeight) + pipeHeight / 2;
var topPipe = new Pipe();
topPipe.x = 2048 + topPipe.width / 2;
topPipe.y = pipeY - gap / 2 - pipeHeight;
pipes.push(topPipe);
game.addChild(topPipe);
var bottomPipe = new Pipe();
bottomPipe.x = 2048 + bottomPipe.width / 2;
bottomPipe.y = pipeY + gap / 2 + pipeHeight;
pipes.push(bottomPipe);
game.addChild(bottomPipe);
}
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.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
if (pipes[i].x < bird.x && !pipes[i].scored) {
score++;
pipes[i].scored = true;
scoreTxt.setText(score);
}
}
if (LK.ticks % 90 == 0) {
spawnPipe();
}
};