/**** * Classes ****/ //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> // Bird class representing the player character 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.45; self.lift = -18; self.update = function () { self.velocity += self.gravity; self.y += self.velocity; // Prevent bird from falling off the screen 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.lift; }; }); // Pipe class representing obstacles var Pipe = Container.expand(function () { var self = Container.call(this); var pipeGraphics = self.attachAsset('pipe', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -14; self.update = function () { self.x += self.speed; if (self.x < -pipeGraphics.width / 2) { self.destroy(); } }; }); // Prize class representing collectible prizes var Prize = Container.expand(function () { var self = Container.call(this); var prizeGraphics = self.attachAsset('cover', { anchorX: 0.5, anchorY: 0.5 }); // Add "+1 Net" text label, larger size var prizeLabel = new Text2('+1 Net', { size: 90, fill: 0xFFFFFF }); prizeLabel.anchor.set(0.5, 0.5); prizeLabel.x = 0; prizeLabel.y = 0; self.addChild(prizeLabel); self.speed = -14; self.update = function () { self.x += self.speed; if (self.x < -prizeGraphics.width / 2) { self.destroy(); } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB // Sky blue background }); /**** * Game Code ****/ // Initialize game variables LK.playMusic('background'); var background = game.addChild(LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5 })); background.x = 2048 / 2; background.y = 2732 / 2; var bird = game.addChild(new Bird()); bird.x = 2048 / 2; bird.y = 2732 / 2; var pipes = []; var pipeInterval = 70; // Interval for pipe generation var prizeInterval = 80; // Interval for prize generation (spawn more prizes) var prizes = []; var ticks = 0; // Score display var scoreTxt = new Text2('0', { size: 120, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Function to create a new pipe function createPipe() { var pipe = new Pipe(); pipe.x = 2048 + pipe.width / 2; pipe.y = Math.random() * (2732 - 400) + 200; // Random y position pipes.push(pipe); game.addChild(pipe); } // Function to create a new prize function createPrize() { var prize = new Prize(); prize.x = 2048 + 100; // Appear just off the right edge prize.y = Math.random() * (2732 - 400) + 200; // Random y position prizes.push(prize); game.addChild(prize); } // Handle game touch events game.down = function (x, y, obj) { bird.flap(); }; // Update game state game.update = function () { bird.update(); // Generate pipes at intervals if (ticks % pipeInterval === 0) { createPipe(); } // Generate prizes at intervals if (ticks % prizeInterval === 0) { createPrize(); } // Update pipes and check for collisions for (var i = pipes.length - 1; i >= 0; i--) { pipes[i].update(); // Track lastWasIntersecting for exact collision moment if (pipes[i].lastWasIntersecting === undefined) pipes[i].lastWasIntersecting = false; var nowIntersecting = bird.intersects(pipes[i]); if (!pipes[i].lastWasIntersecting && nowIntersecting) { LK.effects.flashScreen(0xff0000, 1000); LK.getSound('hit').play(); LK.playMusic('gameover', { loop: false }); // Delay game over to allow sound to play LK.setTimeout(function () { LK.showGameOver(); }, 600); // 600ms to let the sound/music play before reset } pipes[i].lastWasIntersecting = nowIntersecting; if (pipes[i].x < -pipes[i].width / 2) { pipes[i].destroy(); pipes.splice(i, 1); } } // Update prizes and check for collection for (var j = prizes.length - 1; j >= 0; j--) { prizes[j].update(); if (prizes[j].lastWasIntersecting === undefined) prizes[j].lastWasIntersecting = false; var nowPrizeIntersecting = bird.intersects(prizes[j]); if (!prizes[j].lastWasIntersecting && nowPrizeIntersecting) { // Player collects the prize! LK.setScore(LK.getScore() + 1); // Award 1 point for a prize scoreTxt.setText(LK.getScore()); prizes[j].destroy(); prizes.splice(j, 1); continue; } prizes[j].lastWasIntersecting = nowPrizeIntersecting; if (prizes[j].x < -50) { prizes[j].destroy(); prizes.splice(j, 1); } } ticks++; };
/****
* Classes
****/
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Bird class representing the player character
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.45;
self.lift = -18;
self.update = function () {
self.velocity += self.gravity;
self.y += self.velocity;
// Prevent bird from falling off the screen
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.lift;
};
});
// Pipe class representing obstacles
var Pipe = Container.expand(function () {
var self = Container.call(this);
var pipeGraphics = self.attachAsset('pipe', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = -14;
self.update = function () {
self.x += self.speed;
if (self.x < -pipeGraphics.width / 2) {
self.destroy();
}
};
});
// Prize class representing collectible prizes
var Prize = Container.expand(function () {
var self = Container.call(this);
var prizeGraphics = self.attachAsset('cover', {
anchorX: 0.5,
anchorY: 0.5
});
// Add "+1 Net" text label, larger size
var prizeLabel = new Text2('+1 Net', {
size: 90,
fill: 0xFFFFFF
});
prizeLabel.anchor.set(0.5, 0.5);
prizeLabel.x = 0;
prizeLabel.y = 0;
self.addChild(prizeLabel);
self.speed = -14;
self.update = function () {
self.x += self.speed;
if (self.x < -prizeGraphics.width / 2) {
self.destroy();
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB // Sky blue background
});
/****
* Game Code
****/
// Initialize game variables
LK.playMusic('background');
var background = game.addChild(LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5
}));
background.x = 2048 / 2;
background.y = 2732 / 2;
var bird = game.addChild(new Bird());
bird.x = 2048 / 2;
bird.y = 2732 / 2;
var pipes = [];
var pipeInterval = 70; // Interval for pipe generation
var prizeInterval = 80; // Interval for prize generation (spawn more prizes)
var prizes = [];
var ticks = 0;
// Score display
var scoreTxt = new Text2('0', {
size: 120,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Function to create a new pipe
function createPipe() {
var pipe = new Pipe();
pipe.x = 2048 + pipe.width / 2;
pipe.y = Math.random() * (2732 - 400) + 200; // Random y position
pipes.push(pipe);
game.addChild(pipe);
}
// Function to create a new prize
function createPrize() {
var prize = new Prize();
prize.x = 2048 + 100; // Appear just off the right edge
prize.y = Math.random() * (2732 - 400) + 200; // Random y position
prizes.push(prize);
game.addChild(prize);
}
// Handle game touch events
game.down = function (x, y, obj) {
bird.flap();
};
// Update game state
game.update = function () {
bird.update();
// Generate pipes at intervals
if (ticks % pipeInterval === 0) {
createPipe();
}
// Generate prizes at intervals
if (ticks % prizeInterval === 0) {
createPrize();
}
// Update pipes and check for collisions
for (var i = pipes.length - 1; i >= 0; i--) {
pipes[i].update();
// Track lastWasIntersecting for exact collision moment
if (pipes[i].lastWasIntersecting === undefined) pipes[i].lastWasIntersecting = false;
var nowIntersecting = bird.intersects(pipes[i]);
if (!pipes[i].lastWasIntersecting && nowIntersecting) {
LK.effects.flashScreen(0xff0000, 1000);
LK.getSound('hit').play();
LK.playMusic('gameover', {
loop: false
});
// Delay game over to allow sound to play
LK.setTimeout(function () {
LK.showGameOver();
}, 600); // 600ms to let the sound/music play before reset
}
pipes[i].lastWasIntersecting = nowIntersecting;
if (pipes[i].x < -pipes[i].width / 2) {
pipes[i].destroy();
pipes.splice(i, 1);
}
}
// Update prizes and check for collection
for (var j = prizes.length - 1; j >= 0; j--) {
prizes[j].update();
if (prizes[j].lastWasIntersecting === undefined) prizes[j].lastWasIntersecting = false;
var nowPrizeIntersecting = bird.intersects(prizes[j]);
if (!prizes[j].lastWasIntersecting && nowPrizeIntersecting) {
// Player collects the prize!
LK.setScore(LK.getScore() + 1); // Award 1 point for a prize
scoreTxt.setText(LK.getScore());
prizes[j].destroy();
prizes.splice(j, 1);
continue;
}
prizes[j].lastWasIntersecting = nowPrizeIntersecting;
if (prizes[j].x < -50) {
prizes[j].destroy();
prizes.splice(j, 1);
}
}
ticks++;
};
The text color should be white. The background should be orange. The text ÖSYM should be written. . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
It will be a round ball surrounded by thorns. It will have the words 2025 YKS written on it. The ball will look realistic.Let there be fires around it. Let the writing on it be black and thick. . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat