User prompt
Make the birds easier to control
User prompt
Once you fall the floor, you die
User prompt
Please
User prompt
Every single time you die, it shows you your score and a funny picture of a bird
User prompt
Every single time you die, make a funny message relating to birds
User prompt
Every single time the bird falls on the floor he dies
User prompt
Make a score every time you touch the fruit
User prompt
Make a thing called fruit that the bird collects
Initial prompt
Flappy float
/**** * Classes ****/ //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> // Bird class to represent the player var Bird = Container.expand(function () { var self = Container.call(this); var birdGraphics = self.attachAsset('bird', { anchorX: 0.5, anchorY: 0.5 }); self.speedY = 0; self.gravity = 0.5; self.flapStrength = -10; self.update = function () { self.speedY += self.gravity; self.y += self.speedY; // Check for collision with top and bottom of the screen if (self.y < 0) { self.y = 0; self.speedY = 0; } else if (self.y > 2732) { self.y = 2732; self.speedY = 0; } }; self.flap = function () { self.speedY = self.flapStrength; }; }); // Wall class to represent the obstacles var Wall = Container.expand(function () { var self = Container.call(this); var wallGraphics = self.attachAsset('wall', { anchorX: 0.5, anchorY: 0.5 }); self.speedX = -5; self.update = function () { self.x += self.speedX; // Reset wall position if it goes off screen if (self.x < -wallGraphics.width) { self.x = 2048 + wallGraphics.width; self.y = Math.random() * 2000 + 200; } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB // Sky blue background }); /**** * Game Code ****/ // Initialize bird var bird = new Bird(); bird.x = 2048 / 4; bird.y = 2732 / 2; game.addChild(bird); // Initialize walls var walls = []; for (var i = 0; i < 3; i++) { var wall = new Wall(); wall.x = 2048 + i * 700; wall.y = Math.random() * 2000 + 200; walls.push(wall); game.addChild(wall); } // Handle game updates game.update = function () { bird.update(); walls.forEach(function (wall) { wall.update(); // Check for collision with bird if (bird.intersects(wall)) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } }); }; // Handle touch input for flapping game.down = function (x, y, obj) { bird.flap(); };
/****
* Classes
****/
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Bird class to represent the player
var Bird = Container.expand(function () {
var self = Container.call(this);
var birdGraphics = self.attachAsset('bird', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedY = 0;
self.gravity = 0.5;
self.flapStrength = -10;
self.update = function () {
self.speedY += self.gravity;
self.y += self.speedY;
// Check for collision with top and bottom of the screen
if (self.y < 0) {
self.y = 0;
self.speedY = 0;
} else if (self.y > 2732) {
self.y = 2732;
self.speedY = 0;
}
};
self.flap = function () {
self.speedY = self.flapStrength;
};
});
// Wall class to represent the obstacles
var Wall = Container.expand(function () {
var self = Container.call(this);
var wallGraphics = self.attachAsset('wall', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedX = -5;
self.update = function () {
self.x += self.speedX;
// Reset wall position if it goes off screen
if (self.x < -wallGraphics.width) {
self.x = 2048 + wallGraphics.width;
self.y = Math.random() * 2000 + 200;
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB // Sky blue background
});
/****
* Game Code
****/
// Initialize bird
var bird = new Bird();
bird.x = 2048 / 4;
bird.y = 2732 / 2;
game.addChild(bird);
// Initialize walls
var walls = [];
for (var i = 0; i < 3; i++) {
var wall = new Wall();
wall.x = 2048 + i * 700;
wall.y = Math.random() * 2000 + 200;
walls.push(wall);
game.addChild(wall);
}
// Handle game updates
game.update = function () {
bird.update();
walls.forEach(function (wall) {
wall.update();
// Check for collision with bird
if (bird.intersects(wall)) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
});
};
// Handle touch input for flapping
game.down = function (x, y, obj) {
bird.flap();
};