User prompt
Please appear a message on screen "you are in 50 score" when player reach on 50 score
User prompt
Also make the game hard when player reach on score 90
User prompt
Also make the screen some black when background1 is switched
User prompt
Add a function in which background and background1 asset will change in each 10 seconds respectively
User prompt
Remove background colour changing function
User prompt
Also add a new asset named background which literally means the the background of the game
User prompt
Please fix the bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'length')' in or related to this line: 'this.color = options.color || 0xffff00;' Line Number: 178
User prompt
Please fix the bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'length')' in or related to this line: 'this.color = options.color || 0xffff00;' Line Number: 177
User prompt
When the player reach on 60 score ten remove bird asset and add honeybee which will work as bird
User prompt
Please fix the bug: 'Uncaught ReferenceError: PauseButton is not defined' in or related to this line: 'var pauseButton = new PauseButton();' Line Number: 348
User prompt
Remove pause button
User prompt
Remove sun asset when the background colour change into black
User prompt
Please fix the bug: 'Timeout.tick error: filters is not defined' in or related to this line: 'self.starGraphics.filters = [new filters.GlowFilter({' Line Number: 133
User prompt
Please fix the bug: 'ReferenceError: starGraphics is not defined' in or related to this line: 'if (starGraphics) {' Line Number: 47
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of null (setting 'x')' in or related to this line: 'sun.x = 2048 - 150;' Line Number: 188
User prompt
Remove sun when background color change into black
User prompt
Display star asset when background color change into black
User prompt
Please fix the bug: 'ReferenceError: starGraphics is not defined' in or related to this line: 'starGraphics.alpha = 0.5 + 0.5 * Math.sin(LK.ticks / 20);' Line Number: 47
User prompt
Please fix the bug: 'ReferenceError: starGraphics is not defined' in or related to this line: 'starGraphics.alpha = 0.5 + 0.5 * Math.sin(LK.ticks / 20);' Line Number: 47
User prompt
Make the star glows and give light
User prompt
Add new asset "star" which will be visible when the background colour change into black
User prompt
Change the background colour in black in every 10 second
User prompt
Add function of armour to make a blue protective layer around bird
User prompt
Add a button to pause and resume the game in between and make it visible on screen
User prompt
Add a button to pause and resume the game in between
/**** * Classes ****/ // Armour class var Armour = Container.expand(function () { var self = Container.call(this); var armourGraphics = self.attachAsset('armour', { anchorX: 0.5, anchorY: 0.5 }); self.applyToBird = function (bird) { var protectiveLayer = self.attachAsset('armour', { anchorX: 0.5, anchorY: 0.5 }); protectiveLayer.tint = 0x0000ff; // Set the protective layer color to blue bird.addChild(protectiveLayer); LK.setTimeout(function () { bird.removeChild(protectiveLayer); }, 9000); // Remove the protective layer after 9 seconds }; }); // Assets will be automatically created and loaded during gameplay // Bird class var Bird = Container.expand(function () { var self = Container.call(this); var birdGraphics = self.attachAsset('bird', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 10; self.update = function () { // Bird movement logic self.x += self.vx; self.y += self.vy; // Bounce off the walls if (self.x < 0 || self.x > 2048) { self.vx *= -1; self.x = Math.max(0, Math.min(self.x, 2048)); } if (self.y < 0 || self.y > 2732) { self.vy *= -1; self.y = Math.max(0, Math.min(self.y, 2732)); } }; self.vx = 0; self.vy = 0; self.invincible = false; self.setInvincible = function (duration) { self.invincible = true; LK.setTimeout(function () { self.invincible = false; }, duration); }; }); // Bread class var Bread = Container.expand(function () { var self = Container.call(this); var breadGraphics = self.attachAsset('bread', { anchorX: 0.5, anchorY: 0.5 }); }); // Food class var Food = Container.expand(function () { var self = Container.call(this); var foodGraphics = self.attachAsset('food', { anchorX: 0.5, anchorY: 0.5 }); }); var PauseButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('pauseButton', { anchorX: 0.5, anchorY: 0.5 }); var buttonText = new Text2('Pause', { size: 30, fill: "#ffffff" }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.interactive = true; self.buttonMode = true; self.on('down', function () { if (game.paused) { game.resume(); buttonText.setText('Pause'); } else { game.pause(); buttonText.setText('Resume'); } }); }); // Shield class var Shield = Container.expand(function () { var self = Container.call(this); var shieldGraphics = self.attachAsset('shield', { anchorX: 0.5, anchorY: 0.5 }); }); // Sun class var Sun = Container.expand(function () { var self = Container.call(this); var sunGraphics = self.attachAsset('sun', { anchorX: 0.5, anchorY: 0.5 }); }); // Tree class var Tree = Container.expand(function () { var self = Container.call(this); var treeGraphics = self.attachAsset('tree', { anchorX: 0.5, anchorY: 0.5 }); }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB // Sky blue background }); /**** * Game Code ****/ var backgroundColors = [0x000000, 0x87CEEB]; // Black and Sky-blue var currentColorIndex = 0; function changeBackgroundColor() { currentColorIndex = (currentColorIndex + 1) % backgroundColors.length; game.setBackgroundColor(backgroundColors[currentColorIndex]); } LK.setInterval(changeBackgroundColor, 10000); // Change color every 10 seconds // Initialize game variables var sun = game.addChild(new Sun()); sun.x = 2048 - 150; sun.y = 150; var bird = game.addChild(new Bird()); bird.x = 2048 / 2; bird.y = 2732 / 2; bird.vx = 5; bird.vy = 5; var shield = game.addChild(new Shield()); shield.x = Math.random() * 2048; shield.y = Math.random() * 2732; var trees = []; var foods = []; var score = 0; var breadSpawned = false; function spawnBread() { var bread = new Bread(); bread.x = Math.random() * 2048; bread.y = Math.random() * 2732; game.addChild(bread); } function spawnArmour() { var armour = new Armour(); armour.x = Math.random() * 2048; armour.y = Math.random() * 2732; game.addChild(armour); } var armourSpawned = false; var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff", stroke: "#000000", strokeThickness: 10, dropShadow: true, dropShadowColor: "#000000", dropShadowBlur: 4, dropShadowAngle: Math.PI / 6, dropShadowDistance: 6, fontWeight: 'bold', fontStyle: 'italic' }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Function to spawn trees function spawnTree() { var tree = new Tree(); tree.x = Math.random() * 2048; tree.y = Math.random() * 2732; trees.push(tree); game.addChild(tree); } // Function to spawn food function spawnFood() { var food = new Food(); food.x = Math.random() * 2048; food.y = Math.random() * 2732; foods.push(food); game.addChild(food); } // Spawn initial trees and food for (var i = 0; i < 5; i++) { spawnTree(); spawnFood(); spawnFood(); } // Handle bird movement game.down = function (x, y, obj) { var game_position = game.toLocal(obj.global); bird.vx = (game_position.x - bird.x) / 60; bird.vy = (game_position.y - bird.y) / 60; }; // Update game state game.update = function () { bird.update(); // Check for collisions with trees for (var i = 0; i < trees.length; i++) { if (!bird.invincible && bird.intersects(trees[i])) { LK.effects.flashScreen(0xff0000, 1000); var sorryTxt = new Text2('SORRY', { size: 200, fill: "#ff0000", stroke: "#000000", strokeThickness: 10, dropShadow: true, dropShadowColor: "#000000", dropShadowBlur: 4, dropShadowAngle: Math.PI / 6, dropShadowDistance: 6, fontWeight: 'bold', fontStyle: 'italic' }); sorryTxt.anchor.set(0.5, 0.5); sorryTxt.x = 2048 / 2; sorryTxt.y = 2732 / 2; LK.gui.center.addChild(sorryTxt); LK.showGameOver(); return; } } // Check for collisions with food for (var i = 0; i < foods.length; i++) { if (bird.intersects(foods[i])) { score += 2; scoreTxt.setText(score); foods[i].destroy(); foods.splice(i, 1); spawnFood(); if (score >= 20 && !breadSpawned) { spawnBread(); breadSpawned = true; } if (score >= 60 && !armourSpawned) { spawnArmour(); armourSpawned = true; } var armour = game.children.find(function (child) { return child instanceof Armour; }); if (armour && bird.intersects(armour)) { armour.applyToBird(bird); armour.destroy(); armourSpawned = false; } } } // Check for collisions with bread if (breadSpawned) { var bread = game.children.find(function (child) { return child instanceof Bread; }); if (bird.intersects(bread)) { bird.setInvincible(9000); // Make bird invincible for 9 seconds bread.destroy(); breadSpawned = false; } } // Check for collisions with shield if (bird.intersects(shield)) { score += 5; scoreTxt.setText(score); bird.setInvincible(5000); // Make bird invincible for 5 seconds shield.destroy(); shield = game.addChild(new Shield()); shield.x = Math.random() * 2048; shield.y = Math.random() * 2732; } // Check for collisions with walls if (bird.x < 0 || bird.x > 2048 || bird.y < 0 || bird.y > 2732) { LK.effects.flashScreen(0xff0000, 1000); var sorryTxt = new Text2('SORRY', { size: 200, fill: "#ff0000", stroke: "#000000", strokeThickness: 10, dropShadow: true, dropShadowColor: "#000000", dropShadowBlur: 4, dropShadowAngle: Math.PI / 6, dropShadowDistance: 6, fontWeight: 'bold', fontStyle: 'italic' }); sorryTxt.anchor.set(0.5, 0.5); sorryTxt.x = 2048 / 2; sorryTxt.y = 2732 / 2; LK.gui.center.addChild(sorryTxt); LK.showGameOver(); return; } }; var pauseButton = new PauseButton(); pauseButton.x = 2048 - 100; pauseButton.y = 50; LK.gui.top.addChild(pauseButton); var pauseButton = new PauseButton(); pauseButton.x = 2048 - 100; pauseButton.y = 50; LK.gui.top.addChild(pauseButton);
===================================================================
--- original.js
+++ change.js
@@ -133,9 +133,9 @@
function changeBackgroundColor() {
currentColorIndex = (currentColorIndex + 1) % backgroundColors.length;
game.setBackgroundColor(backgroundColors[currentColorIndex]);
}
-LK.setInterval(changeBackgroundColor, 20000); // Change color every 20 seconds
+LK.setInterval(changeBackgroundColor, 10000); // Change color every 10 seconds
// Initialize game variables
var sun = game.addChild(new Sun());
sun.x = 2048 - 150;
sun.y = 150;
A honeybee. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A glass bottle filled with honey. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A block of stone. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A shield of IRON MAN. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
sun. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Piece of bread. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
White star and give them glowing effect. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A small armour fit for honeybee. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Blue sky with white colour cloud. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Black sky with night weather and also imagine glowing white star and moon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.