User prompt
Didn’t work
User prompt
Fix this problem
User prompt
Why does closing the shop open the game over
User prompt
Closing the shop should bring you back to the main menu
User prompt
The game shouldn’t start when you open the shop
User prompt
Make it so you don’t die after leaving the shop
User prompt
Make the skins cost less
User prompt
Make the skins different assets
User prompt
The white and orange are still changing
User prompt
It still doesn’t work ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
It didn’t work
User prompt
Make the skins not change the colors white and orange
User prompt
Add a skin shop ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Make a skin shop ↪💡 Consider importing and using the following plugins: @upit/storage.v1, @upit/tween.v1
User prompt
Make a start screen
User prompt
Make the seeds spawn more in the middle
User prompt
Make the walls bigger
User prompt
Make the seeds bigger
User prompt
Even bigger
User prompt
Make the seeds bigger
User prompt
Make the spikes bigger
User prompt
Make the spikes bigger
User prompt
Do it again but make the spike blue
User prompt
Make the walls the same color as the spike ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the bottom and top sides kill you
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Bird = Container.expand(function () { var self = Container.call(this); // Bird asset var birdGraphics = self.attachAsset('bird', { anchorX: 0.5, anchorY: 0.5, scaleX: 3.5, scaleY: 3.5 }); // Bird physics properties self.velocityY = 0; self.velocityX = 12; // Increased from 8 to 12 for faster horizontal movement self.gravity = 1.0; // Increased from 0.7 to 1.0 for stronger gravity self.flapStrength = -20; // Increased from -15 to -20 for higher jumps self.lastX = 0; self.lastY = 0; self.lastWasIntersecting = false; // Handle tap/click on bird self.down = function (x, y, obj) { self.flap(); }; // Make bird flap wings self.flap = function () { self.velocityY = self.flapStrength; }; // Update bird physics self.update = function () { // Store last position self.lastX = self.x; self.lastY = self.y; // Apply gravity self.velocityY += self.gravity; // Update position self.y += self.velocityY; self.x += self.velocityX; // Visual feedback - rotate bird based on velocity var targetRotation = Math.min(Math.max(self.velocityY / 15, -0.5), 0.5); // Make bird face the direction it's flying by flipping the sprite if (self.velocityX > 0) { birdGraphics.scaleX = Math.abs(birdGraphics.scaleX); // Face right birdGraphics.rotation = targetRotation; // Apply rotation normally for right-facing bird } else { birdGraphics.scaleX = -Math.abs(birdGraphics.scaleX); // Face left birdGraphics.rotation = -targetRotation; // Invert rotation for left-facing bird } }; return self; }); var Seed = Container.expand(function () { var self = Container.call(this); // Seed asset var seedGraphics = self.attachAsset('seed', { anchorX: 0.5, anchorY: 0.5, scaleX: 3.5, scaleY: 3.5 }); // Seed properties self.lastWasIntersecting = false; self.speedX = 0; // Set speed to 0 to stop seeds from moving // Animation effect self.update = function () { // No longer updating x position seedGraphics.rotation += 0.05; // Remove seeds that are off-screen if (self.x < -50) { self.shouldBeRemoved = true; } }; return self; }); var Spike = Container.expand(function () { var self = Container.call(this); // Create spike shape using a triangle var spikeGraphics = self.attachAsset('shape', { width: 200, height: 200, color: 0x0000FF, // Blue color for spike shape: 'box', anchorX: 0.5, anchorY: 0.5 }); // Rotate to make it look like a spike spikeGraphics.rotation = Math.PI / 4; // 45 degrees self.isStuck = false; self.wall = null; self.lastWasIntersecting = false; // Stick to a wall self.stickTo = function (wall) { self.isStuck = true; self.wall = wall; // Position on wall edge based on wall orientation if (wall.isVertical) { self.x = wall.x + (wall.x < 1024 ? 50 : -50); // Left or right wall - adjusted for wider walls // Keep y position where the collision happened } else { self.y = wall.y + (wall.y < 1366 ? 50 : -50); // Top or bottom wall - adjusted for taller walls // Keep x position where the collision happened } }; self.update = function () { // Nothing to update when stuck if (!self.isStuck) { // If not stuck, spike can move or be collected later self.rotation += 0.05; } }; return self; }); var StartScreen = Container.expand(function () { var self = Container.call(this); // Create title text var titleText = new Text2('BOUNCE BIRD', { size: 150, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0.5); titleText.x = 2048 / 2; titleText.y = 2732 / 3; self.addChild(titleText); // Create start button var startButton = new Container(); var buttonBg = startButton.attachAsset('shape', { width: 500, height: 150, color: 0x4682B4, shape: 'box', anchorX: 0.5, anchorY: 0.5 }); var startText = new Text2('TAP TO START', { size: 80, fill: 0xFFFFFF }); startText.anchor.set(0.5, 0.5); startButton.addChild(startText); startButton.x = 2048 / 2; startButton.y = 2732 / 2; self.addChild(startButton); // Add a bouncing bird animation var demoBird = self.attachAsset('bird', { anchorX: 0.5, anchorY: 0.5, scaleX: 4, scaleY: 4, x: 2048 / 2, y: 2732 * 0.7 }); // Make the button pulse self.update = function () { var scale = 1 + Math.sin(LK.ticks / 20) * 0.05; startButton.scale.set(scale); // Make the bird bounce demoBird.y = 2732 * 0.7 + Math.sin(LK.ticks / 15) * 50; demoBird.rotation = Math.sin(LK.ticks / 30) * 0.2; }; // Handle tap event self.down = function () { if (self.onStart) { self.onStart(); } }; return self; }); var Wall = Container.expand(function () { var self = Container.call(this); // Wall properties self.isVertical = true; self.wallGraphics = null; // Initialize with wall type (vertical/horizontal) self.init = function (vertical) { self.isVertical = vertical; if (vertical) { self.wallGraphics = self.attachAsset('wall', { anchorX: 0.5, anchorY: 0.5 }); } else { self.wallGraphics = self.attachAsset('ceiling', { anchorX: 0.5, anchorY: 0.5 }); } return self; }; return self; }); /**** * Initialize Game ****/ // Change background color to sky blue var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Change background color to sky blue // Assets for Bounce Bird // Import tween plugin game.setBackgroundColor(0x87CEEB); // Game variables var bird; var walls = []; var seeds = []; var spikes = []; var score = 0; var gameWidth = 2048; var gameHeight = 2732; var gameStarted = false; var startScreen; // Create start screen function showStartScreen() { startScreen = new StartScreen(); startScreen.onStart = function () { gameStarted = true; startScreen.destroy(); startScreen = null; startGame(); }; game.addChild(startScreen); } // Initialize the actual game function startGame() { createBird(); createWalls(); createScoreDisplay(); } // Create score text var scoreText; function createScoreDisplay() { scoreText = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreText.anchor.set(0, 0); LK.gui.topLeft.addChild(scoreText); scoreText.x = 120; // Avoid the top-left 100x100 menu area scoreText.y = 50; } // Create bird function createBird() { bird = new Bird(); bird.x = gameWidth / 4; bird.y = gameHeight / 2; game.addChild(bird); } // Create walls (top, bottom, left, right) function createWalls() { // Top wall (ceiling) var ceiling = new Wall().init(false); ceiling.x = gameWidth / 2; ceiling.y = 40; game.addChild(ceiling); walls.push(ceiling); // Bottom wall (floor) var floor = new Wall().init(false); floor.x = gameWidth / 2; floor.y = gameHeight - 40; game.addChild(floor); walls.push(floor); // Left wall var leftWall = new Wall().init(true); leftWall.x = 40; leftWall.y = gameHeight / 2; game.addChild(leftWall); walls.push(leftWall); // Right wall var rightWall = new Wall().init(true); rightWall.x = gameWidth - 40; rightWall.y = gameHeight / 2; game.addChild(rightWall); walls.push(rightWall); } // Show start screen instead of immediately starting the game showStartScreen(); // Spawn a new seed at a random position function spawnSeed() { var seed = new Seed(); seed.x = gameWidth + 50; seed.y = Math.random() * (gameHeight - 200) + 100; seeds.push(seed); game.addChild(seed); } // Handle click/tap anywhere on screen game.down = function (x, y, obj) { if (gameStarted && bird) { bird.flap(); } }; // Update function game.update = function () { // Don't process game logic if game hasn't started yet if (!gameStarted) { return; } // Seeds now spawn on bounce, not periodically // Update seeds for (var i = seeds.length - 1; i >= 0; i--) { var seed = seeds[i]; // Check for collision with bird var currentIntersecting = bird.intersects(seed); if (!seed.lastWasIntersecting && currentIntersecting) { // Collected seed score++; scoreText.setText("Score: " + score); LK.setScore(score); LK.getSound('collect').play(); // Remove seed seed.destroy(); seeds.splice(i, 1); } else { seed.lastWasIntersecting = currentIntersecting; // Remove seeds that should be removed if (seed.shouldBeRemoved) { seed.destroy(); seeds.splice(i, 1); } } } // Check for wall collisions for (var i = 0; i < walls.length; i++) { var wall = walls[i]; var currentIntersecting = bird.intersects(wall); if (!bird.lastWasIntersecting && currentIntersecting) { // Check if bird hit ceiling or floor (horizontal walls) if (!wall.isVertical) { // Bird hit ceiling or floor - game over! LK.effects.flashScreen(0xFF0000, 500); LK.showGameOver(); break; } else { // Bird hit a side wall - bounce! LK.getSound('bounce').play(); // Apply bounce physics bird.velocityX *= -1; // Reverse horizontal direction // Push bird away from wall to prevent sticking bird.x += bird.velocityX > 0 ? 5 : -5; // Visual feedback for bounce LK.effects.flashObject(bird, 0xFFFFFF, 200); // Clear old seeds and spikes on bounce for (var j = seeds.length - 1; j >= 0; j--) { seeds[j].destroy(); seeds.splice(j, 1); } // Clear all existing spikes for (var j = spikes.length - 1; j >= 0; j--) { spikes[j].destroy(); spikes.splice(j, 1); } // Reset all wall colors to the original blue color for (var j = 0; j < walls.length; j++) { if (walls[j].isVertical) { tween(walls[j].wallGraphics, { tint: 0x4682b4 }, { duration: 300, easing: tween.easeIn }); } } // Spawn two new seeds on bounce for (var k = 0; k < 2; k++) { var newSeed = new Seed(); // Make seeds spawn more in the middle - use narrower range centered around the middle var middleX = gameWidth / 2; var middleY = gameHeight / 2; var spawnWidth = gameWidth * 0.6; // Use 60% of screen width var spawnHeight = gameHeight * 0.6; // Use 60% of screen height newSeed.x = middleX + (Math.random() - 0.5) * spawnWidth; newSeed.y = middleY + (Math.random() - 0.5) * spawnHeight; seeds.push(newSeed); game.addChild(newSeed); } // Add a spike that sticks to the opposite wall var spike = new Spike(); // Place spike on opposite vertical wall targetWall = wall.x < gameWidth / 2 ? walls[3] : walls[2]; // walls[3] is right wall, walls[2] is left wall spike.x = targetWall.x; spike.y = Math.random() * (gameHeight - 200) + 100; // Random Y position spike.stickTo(targetWall); spikes.push(spike); game.addChild(spike); // Change the target wall color to match the spike color (blue) tween(targetWall.wallGraphics, { tint: 0x0000FF }, { duration: 300, easing: tween.easeOut }); } // Set lastWasIntersecting for the specific wall collision that just happened bird.lastWasIntersecting = true; break; // Exit the loop after handling a collision } } // Reset lastWasIntersecting if not intersecting any wall var intersectingAnyWall = false; for (var i = 0; i < walls.length; i++) { if (bird.intersects(walls[i])) { intersectingAnyWall = true; break; } } if (!intersectingAnyWall) { bird.lastWasIntersecting = false; } // Check for spike collisions for (var i = 0; i < spikes.length; i++) { var spike = spikes[i]; var currentIntersecting = bird.intersects(spike); if (!spike.lastWasIntersecting && currentIntersecting) { // Bird hit a spike - game over! LK.effects.flashScreen(0xFF0000, 500); LK.showGameOver(); break; } spike.lastWasIntersecting = currentIntersecting; } // Check if bird flew off screen (game over condition) if (bird.y < -100 || bird.y > gameHeight + 100 || bird.x < -100 || bird.x > gameWidth + 100) { LK.effects.flashScreen(0xFF0000, 500); LK.showGameOver(); } };
===================================================================
--- original.js
+++ change.js
@@ -115,8 +115,63 @@
}
};
return self;
});
+var StartScreen = Container.expand(function () {
+ var self = Container.call(this);
+ // Create title text
+ var titleText = new Text2('BOUNCE BIRD', {
+ size: 150,
+ fill: 0xFFFFFF
+ });
+ titleText.anchor.set(0.5, 0.5);
+ titleText.x = 2048 / 2;
+ titleText.y = 2732 / 3;
+ self.addChild(titleText);
+ // Create start button
+ var startButton = new Container();
+ var buttonBg = startButton.attachAsset('shape', {
+ width: 500,
+ height: 150,
+ color: 0x4682B4,
+ shape: 'box',
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var startText = new Text2('TAP TO START', {
+ size: 80,
+ fill: 0xFFFFFF
+ });
+ startText.anchor.set(0.5, 0.5);
+ startButton.addChild(startText);
+ startButton.x = 2048 / 2;
+ startButton.y = 2732 / 2;
+ self.addChild(startButton);
+ // Add a bouncing bird animation
+ var demoBird = self.attachAsset('bird', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 4,
+ scaleY: 4,
+ x: 2048 / 2,
+ y: 2732 * 0.7
+ });
+ // Make the button pulse
+ self.update = function () {
+ var scale = 1 + Math.sin(LK.ticks / 20) * 0.05;
+ startButton.scale.set(scale);
+ // Make the bird bounce
+ demoBird.y = 2732 * 0.7 + Math.sin(LK.ticks / 15) * 50;
+ demoBird.rotation = Math.sin(LK.ticks / 30) * 0.2;
+ };
+ // Handle tap event
+ self.down = function () {
+ if (self.onStart) {
+ self.onStart();
+ }
+ };
+ return self;
+});
var Wall = Container.expand(function () {
var self = Container.call(this);
// Wall properties
self.isVertical = true;
@@ -162,22 +217,46 @@
var spikes = [];
var score = 0;
var gameWidth = 2048;
var gameHeight = 2732;
+var gameStarted = false;
+var startScreen;
+// Create start screen
+function showStartScreen() {
+ startScreen = new StartScreen();
+ startScreen.onStart = function () {
+ gameStarted = true;
+ startScreen.destroy();
+ startScreen = null;
+ startGame();
+ };
+ game.addChild(startScreen);
+}
+// Initialize the actual game
+function startGame() {
+ createBird();
+ createWalls();
+ createScoreDisplay();
+}
// Create score text
-var scoreText = new Text2('Score: 0', {
- size: 80,
- fill: 0xFFFFFF
-});
-scoreText.anchor.set(0, 0);
-LK.gui.topLeft.addChild(scoreText);
-scoreText.x = 120; // Avoid the top-left 100x100 menu area
-scoreText.y = 50;
+var scoreText;
+function createScoreDisplay() {
+ scoreText = new Text2('Score: 0', {
+ size: 80,
+ fill: 0xFFFFFF
+ });
+ scoreText.anchor.set(0, 0);
+ LK.gui.topLeft.addChild(scoreText);
+ scoreText.x = 120; // Avoid the top-left 100x100 menu area
+ scoreText.y = 50;
+}
// Create bird
-bird = new Bird();
-bird.x = gameWidth / 4;
-bird.y = gameHeight / 2;
-game.addChild(bird);
+function createBird() {
+ bird = new Bird();
+ bird.x = gameWidth / 4;
+ bird.y = gameHeight / 2;
+ game.addChild(bird);
+}
// Create walls (top, bottom, left, right)
function createWalls() {
// Top wall (ceiling)
var ceiling = new Wall().init(false);
@@ -203,10 +282,10 @@
rightWall.y = gameHeight / 2;
game.addChild(rightWall);
walls.push(rightWall);
}
-// Create initial walls
-createWalls();
+// Show start screen instead of immediately starting the game
+showStartScreen();
// Spawn a new seed at a random position
function spawnSeed() {
var seed = new Seed();
seed.x = gameWidth + 50;
@@ -215,12 +294,18 @@
game.addChild(seed);
}
// Handle click/tap anywhere on screen
game.down = function (x, y, obj) {
- bird.flap();
+ if (gameStarted && bird) {
+ bird.flap();
+ }
};
// Update function
game.update = function () {
+ // Don't process game logic if game hasn't started yet
+ if (!gameStarted) {
+ return;
+ }
// Seeds now spawn on bounce, not periodically
// Update seeds
for (var i = seeds.length - 1; i >= 0; i--) {
var seed = seeds[i];
Big sunflower seed. In-Game asset. 2d. High contrast. No shadows
Square shaped gold bird. In-Game asset. 2d. High contrast. No shadows
Square shaped green bird facing to the right. In-Game asset. 2d. High contrast. No shadows
Square shaped orange bird facing right
Square shaped red bird facing right. In-Game asset. 2d. High contrast. No shadows
Square shaped rainbow bird facing right. In-Game asset. 2d. High contrast. No shadows