User prompt
Make the shooterers shooting speed a little more faster everytime.
User prompt
Everytime the shooters shooting speed should increase by 0.00002 seconds
User prompt
Make a score bar on the top middle.
User prompt
Everytime the enemies speed should increase by 0.0001 seconds.
User prompt
Everytime the enemies speed should increase by 0.002 seconds
User prompt
Make this game available on every platform. And also make it that every time the player kills an enemy he gets 1 coin
User prompt
Make it that only 4 players come at a time
User prompt
Make it that only 5 players come at a time
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addEventListener')' in or related to this line: 'document.addEventListener('keydown', function (event) {' Line Number: 153
User prompt
On PC and laptop the shooting button should be X
User prompt
On laptops make it that the player moves with arrow keys
User prompt
Make it that only 7 enemies appear at one time
User prompt
Make the shooters speed a little more
User prompt
Make it that more enemies appear everytime. and the speed of enemies should increase by 0.02 seconds everytime
User prompt
Remove the shooting button. Also make it that the shooter can move while shooting
User prompt
If the player missed any enemy then the game should end. And Also make a specific button from where the shooter will shoot. The button should be placed the right side
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addEventListener')' in or related to this line: 'document.addEventListener('keydown', function (event) {' Line Number: 133
User prompt
Make it so that the shooter can move left right will shooting
User prompt
Bullets should go up in the sky and each bullet that touches the enemy, the enemy should die from it
User prompt
Make it that my bullets don't fall automatically and only the enemy falls. If the enemy touches me then I lose. Enemy should only target me
User prompt
Make that the enemy attacks me. And I can only shoot when I press a specific button
Initial prompt
Critical Strike
/**** * Classes ****/ // Bullet class for player and enemy bullets var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 15; self.update = function () {}; }); // Enemy class representing enemy characters var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { // Enemy moves down the screen self.y += self.speed; // Game over if enemy touches player if (self.intersects(player)) { LK.showGameOver(); } }; }); //<Assets used in the game will automatically appear here> // Player class representing the main character var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 10; self.update = function () { // Player update logic }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Initialize player var player = game.addChild(new Player()); player.x = 2048 / 2; player.y = 2732 - 200; // Initialize enemies array var enemies = []; // Initialize bullets array var bullets = []; // Function to spawn enemies function spawnEnemy() { var enemy = new Enemy(); enemy.x = Math.random() * 2048; enemy.y = 0; enemies.push(enemy); game.addChild(enemy); } // Function to handle player shooting function shootBullet() { var bullet = new Bullet(); bullet.x = player.x; bullet.y = player.y; bullets.push(bullet); game.addChild(bullet); } // Game update loop game.update = function () { // Update player player.update(); // Update enemies for (var i = enemies.length - 1; i >= 0; i--) { enemies[i].update(); if (enemies[i].y > 2732) { enemies[i].destroy(); enemies.splice(i, 1); } } // Update bullets for (var j = bullets.length - 1; j >= 0; j--) { bullets[j].update(); if (bullets[j].y < 0) { bullets[j].destroy(); bullets.splice(j, 1); } } // Check for collisions between bullets and enemies for (var k = bullets.length - 1; k >= 0; k--) { for (var l = enemies.length - 1; l >= 0; l--) { if (bullets[k].intersects(enemies[l])) { bullets[k].destroy(); bullets.splice(k, 1); enemies[l].destroy(); enemies.splice(l, 1); break; } } } }; // Set interval to spawn enemies LK.setInterval(spawnEnemy, 2000); // Player shoots on button press game.down = function (x, y, obj) { shootBullet(); }; // Handle player movement game.move = function (x, y, obj) { player.x = x; player.y = y; };
===================================================================
--- original.js
+++ change.js
@@ -8,11 +8,9 @@
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
- self.update = function () {
- self.y -= self.speed;
- };
+ self.update = function () {};
});
// Enemy class representing enemy characters
var Enemy = Container.expand(function () {
var self = Container.call(this);
@@ -23,15 +21,11 @@
self.speed = 5;
self.update = function () {
// Enemy moves down the screen
self.y += self.speed;
- // Enemy shoots a bullet every 60 frames
- if (LK.ticks % 60 == 0) {
- var bullet = new Bullet();
- bullet.speed = -5; // Bullet moves upwards
- bullet.x = self.x;
- bullet.y = self.y;
- game.addChild(bullet);
+ // Game over if enemy touches player
+ if (self.intersects(player)) {
+ LK.showGameOver();
}
};
});
//<Assets used in the game will automatically appear here>