User prompt
Shotguns or pistols can drop from chests or zombies and we can pick them up and they come with bullets
User prompt
add game kebab loot and it can be eatable and give 20 hp
User prompt
add new epsode more difficult
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'price')' in or related to this line: 'if (currentScore >= item.price) {' Line Number: 468
User prompt
Each episode should be harder than the previous one.
User prompt
There should be random chests in each section, these should take 3 bullets and random items should come out of them, at most two. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
There will be random chests in each section, these will take 3 bullets and random items will come out of them. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
To continue to the 2nd section, contact the soldier. To pass the 2nd section, it is necessary to kill 20 normal, 7 fast and 2 tanks.
User prompt
At the end of each level, items that can be purchased with our score from the armored vehicle will come energy drink 50 scores 30 bullets 50 scores health pack 100 scores sandwich 20 scores ↪💡 Consider importing and using the following plugins: @upit/storage.v1, @upit/tween.v1
User prompt
Create ArmoredVehicle class for military rescue vehicles ✅ Replace basic armored car with proper militarycar class in victory sequence
User prompt
give eksrta 30 bullet
User prompt
When you kill 15 normal, 5 fast and 1 tankzombie, the "episode is over" message will appear.Create ArmoredVehicle class for military rescue vehicles Replace basic armored car with proper ArmoredVehicle class in victory sequence
User prompt
soldiers should come with armored military vehicles
User prompt
Energy drink increases my speed and fire rate for 10 seconds ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
When I buy armor, let the armor decrease before I die.
User prompt
When we kill 15 normal, 3 fast and 1 tank, no more zombies will come and 2 soldiers will come to the screen with an armored car.
User prompt
When we kill 15 normal, 3 fast and 1 tank, no more zombies will come and 2 soldiers will come to the screen with an armored car.
User prompt
zombies drop food and energy drink inside
User prompt
Let the zombies hit 10 and the tank hit 15
User prompt
Fast zombies should have 3 bullets and tanks should have 20 bullets.
User prompt
Put 1 more charger
User prompt
don't stop
User prompt
go to where the cursor is pointing
User prompt
its stil not wprking
User prompt
its not working
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Bullet = Container.expand(function (startX, startY, targetX, targetY, damage) { var self = Container.call(this); var bulletGraphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.damage = damage; self.speed = 8; // Calculate direction var dx = targetX - startX; var dy = targetY - startY; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { self.dirX = dx / distance; self.dirY = dy / distance; } else { self.dirX = 1; self.dirY = 0; } // Set rotation to match direction bulletGraphics.rotation = Math.atan2(dy, dx); self.update = function () { self.x += self.dirX * self.speed; self.y += self.dirY * self.speed; }; return self; }); var Item = Container.expand(function (itemType) { var self = Container.call(this); var itemGraphics = self.attachAsset(itemType, { anchorX: 0.5, anchorY: 0.5 }); self.type = itemType; self.collected = false; self.collect = function () { if (self.collected) return false; var success = false; switch (self.type) { case 'helmet': case 'armor': case 'backpack': player.equipArmor(self.type); success = true; break; case 'healthPack': player.heal(player.maxHealth); success = true; break; case 'food': player.heal(20); success = true; break; case 'energyDrink': player.speed = player.baseSpeed * 1.25; // Speed boost timer LK.setTimeout(function () { player.speed = player.baseSpeed; }, 10000); player.shootCooldown = Math.max(1, player.shootCooldown * 0.85); // Fire rate boost timer LK.setTimeout(function () { player.shootCooldown = Math.max(1, player.shootCooldown / 0.85); }, 10000); success = true; break; case 'rifle': player.equipWeapon(self.type); success = true; break; case 'ammo': totalBullets += 30; // Add one magazine worth of bullets LK.setScore(LK.getScore() + 5); success = true; break; } if (success) { self.collected = true; LK.getSound('pickup').play(); return true; } return false; }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); // Player stats self.maxHealth = 100; self.health = self.maxHealth; self.speed = 3; self.baseSpeed = 3; self.weapon = 'knife'; self.weaponDamage = 25; self.attackCooldown = 0; self.shootCooldown = 0; self.isRangedWeapon = false; self.armor = 0; self.inventorySize = 3; self.inventory = []; // Equipment visuals self.weaponSprite = null; self.helmetSprite = null; self.armorSprite = null; self.backpackSprite = null; self.equipWeapon = function (weaponType) { if (self.weaponSprite) { self.removeChild(self.weaponSprite); } self.weapon = weaponType; self.weaponSprite = self.attachAsset(weaponType, { anchorX: 0.5, anchorY: 0.5, x: 35, y: 0 }); switch (weaponType) { case 'rifle': self.weaponDamage = 60; self.isRangedWeapon = true; break; } }; self.equipArmor = function (armorType) { if (armorType === 'helmet' && !self.helmetSprite) { self.helmetSprite = self.attachAsset('helmet', { anchorX: 0.5, anchorY: 0.5, x: 0, y: -35 }); self.armor += 20; } else if (armorType === 'armor' && !self.armorSprite) { self.armorSprite = self.attachAsset('armor', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 10 }); self.armor += 50; // Increase armor by 50 } else if (armorType === 'backpack' && !self.backpackSprite) { self.backpackSprite = self.attachAsset('backpack', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 40 }); self.inventorySize += 3; } }; self.takeDamage = function (damage) { var actualDamage = Math.max(1, damage - self.armor); self.health -= actualDamage; LK.effects.flashObject(self, 0xff0000, 200); if (self.health <= 0) { LK.showGameOver(); } }; self.heal = function (amount) { self.health = Math.min(self.maxHealth, self.health + amount); }; self.update = function () { if (self.attackCooldown > 0) { self.attackCooldown--; } if (self.shootCooldown > 0) { self.shootCooldown--; } }; // Start with rifle self.equipWeapon('rifle'); return self; }); var Zombie = Container.expand(function (type) { var self = Container.call(this); var zombieType = type || 'zombie'; var zombieGraphics = self.attachAsset(zombieType, { anchorX: 0.5, anchorY: 0.5, scaleX: 0.5, // Reduce width by 50% scaleY: 0.5 // Reduce height by 50% }); // Zombie stats based on type switch (zombieType) { case 'zombie': self.health = 300; // 5 bullets (60 damage per bullet) self.speed = 0.5; self.damage = 10; // Reduced damage self.points = 10; break; case 'fastZombie': self.health = 300; // 5 bullets (60 damage per bullet) self.speed = 1.5; self.damage = 8; // Reduced damage self.points = 15; break; case 'tankZombie': self.health = 1800; // 30 bullets (60 damage per bullet) self.speed = 0.4; self.damage = 25; self.points = 25; break; } self.maxHealth = self.health; self.type = zombieType; self.attackCooldown = 0; self.takeDamage = function (damage) { self.health -= damage; LK.effects.flashObject(self, 0xff0000, 150); if (self.health <= 0) { return true; // Dead } return false; }; self.update = function () { if (self.attackCooldown > 0) { self.attackCooldown--; } // Always aggressively pursue player position var dx = player.x - self.x; var dy = player.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { // Increase pursuit speed based on distance - zombies move faster when player is farther var pursuitMultiplier = Math.min(2, distance / 200); var actualSpeed = self.speed * (1 + pursuitMultiplier); self.x += dx / distance * actualSpeed; self.y += dy / distance * actualSpeed; } // Attack player if close enough - adjusted for much bigger zombies var attackRange = zombieType === 'tankZombie' ? 110 : zombieType === 'zombie' ? 90 : 80; if (distance < attackRange && self.attackCooldown <= 0) { player.takeDamage(self.damage); self.attackCooldown = 60; // 1 second at 60fps LK.getSound('hit').play(); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2c2c2c }); /**** * Game Code ****/ // Game variables // Player and weapons // Zombies // Items // Mall elements // Sounds var player; var zombies = []; var bullets = []; var items = []; var walls = []; var zombieSpawnTimer = 0; var zombieSpawnRate = 180; // 3 seconds at 60fps var difficultyTimer = 0; var gameTime = 0; // Level progression variables var currentLevel = 1; var maxLevels = 5; var normalZombiesKilled = 0; var fastZombiesKilled = 0; var tankZombiesKilled = 0; var normalZombiesToKill = 20; var fastZombiesToKill = 5; var tankZombiesToKill = 1; // Magazine system var totalBullets = 90; var bulletsPerMagazine = 30; var currentMagazineBullets = bulletsPerMagazine; var isReloading = false; var reloadTimer = 0; var reloadTime = 120; // 2 seconds at 60fps // UI Elements var healthText = new Text2('Health: 100', { size: 40, fill: 0xFFFFFF // Change health text color to white }); healthText.anchor.set(0, 0); LK.gui.topLeft.addChild(healthText); healthText.x = 120; // Avoid menu icon var scoreText = new Text2('Score: 0', { size: 40, fill: 0xFFFFFF }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); var weaponText = new Text2('Weapon: Knife', { size: 35, fill: 0xFFFF00 }); weaponText.anchor.set(1, 0); LK.gui.topRight.addChild(weaponText); var ammoText = new Text2('Ammo: 30/90', { size: 35, fill: 0x00FFFF }); ammoText.anchor.set(1, 0); ammoText.y = 50; LK.gui.topRight.addChild(ammoText); // Create player player = game.addChild(new Player()); player.x = 1024; player.y = 1366; // Create mall layout function createMallLayout() { // Create walls around the perimeter for (var x = 0; x < 2048; x += 100) { var topWall = game.addChild(LK.getAsset('wall', { anchorX: 0.5, anchorY: 0.5 })); topWall.x = x + 50; topWall.y = 50; walls.push(topWall); var bottomWall = game.addChild(LK.getAsset('wall', { anchorX: 0.5, anchorY: 0.5 })); bottomWall.x = x + 50; bottomWall.y = 2682; walls.push(bottomWall); } for (var y = 100; y < 2632; y += 100) { var leftWall = game.addChild(LK.getAsset('wall', { anchorX: 0.5, anchorY: 0.5 })); leftWall.x = 50; leftWall.y = y + 50; walls.push(leftWall); var rightWall = game.addChild(LK.getAsset('wall', { anchorX: 0.5, anchorY: 0.5 })); rightWall.x = 1998; rightWall.y = y + 50; walls.push(rightWall); } } function spawnZombie() { var zombieTypes = ['zombie', 'zombie', 'zombie', 'fastZombie', 'tankZombie']; var zombieType = zombieTypes[Math.floor(Math.random() * zombieTypes.length)]; // Make tank zombies rarer early on if (zombieType === 'tankZombie' && gameTime < 1800) { zombieType = 'zombie'; } var zombie = game.addChild(new Zombie(zombieType)); // Spawn at random edge var side = Math.floor(Math.random() * 4); switch (side) { case 0: // Top zombie.x = Math.random() * 1948 + 100; zombie.y = 150; break; case 1: // Right zombie.x = 1898; zombie.y = Math.random() * 2432 + 150; break; case 2: // Bottom zombie.x = Math.random() * 1948 + 100; zombie.y = 2582; break; case 3: // Left zombie.x = 150; zombie.y = Math.random() * 2432 + 150; break; } zombies.push(zombie); } function checkCollisions() { // Player vs items for (var i = items.length - 1; i >= 0; i--) { var item = items[i]; if (player.intersects(item) && item.collect()) { item.destroy(); items.splice(i, 1); } } // Bullet vs zombie collisions for (var b = bullets.length - 1; b >= 0; b--) { var bullet = bullets[b]; var bulletHit = false; // Check if bullet is out of bounds if (bullet.x < 0 || bullet.x > 2048 || bullet.y < 0 || bullet.y > 2732) { bullet.destroy(); bullets.splice(b, 1); continue; } // Check bullet vs zombies for (var z = zombies.length - 1; z >= 0; z--) { var zombie = zombies[z]; if (bullet.intersects(zombie)) { if (zombie.takeDamage(bullet.damage)) { // Zombie died LK.setScore(LK.getScore() + zombie.points); LK.getSound('zombieHit').play(); // Random drop chance if (Math.random() < 0.50) { var dropTypes = ['rifle', 'ammo', 'healthPack']; var dropType = dropTypes[Math.floor(Math.random() * dropTypes.length)]; var drop = new Item(dropType); drop.x = zombie.x; drop.y = zombie.y; items.push(drop); game.addChild(drop); } // Track zombie kills for level progression switch (zombie.type) { case 'zombie': normalZombiesKilled++; break; case 'fastZombie': fastZombiesKilled++; break; case 'tankZombie': tankZombiesKilled++; break; } zombie.destroy(); zombies.splice(z, 1); } bullet.destroy(); bullets.splice(b, 1); bulletHit = true; break; } } if (bulletHit) continue; } // Player melee attacks zombies (only for knife) if (!player.isRangedWeapon && player.attackCooldown <= 0) { for (var z = zombies.length - 1; z >= 0; z--) { var zombie = zombies[z]; var distance = Math.sqrt((player.x - zombie.x) * (player.x - zombie.x) + (player.y - zombie.y) * (player.y - zombie.y)); var meleeRange = zombie.type === 'tankZombie' ? 120 : zombie.type === 'zombie' ? 100 : 90; if (distance < meleeRange) { if (zombie.takeDamage(player.weaponDamage)) { // Zombie died LK.setScore(LK.getScore() + zombie.points); LK.getSound('zombieHit').play(); // Random drop chance if (Math.random() < 0.50) { var dropTypes = ['rifle', 'ammo', 'healthPack']; var dropType = dropTypes[Math.floor(Math.random() * dropTypes.length)]; var drop = new Item(dropType); drop.x = zombie.x; drop.y = zombie.y; items.push(drop); game.addChild(drop); } zombie.destroy(); zombies.splice(z, 1); } player.attackCooldown = 30; // Half second break; } } } } function updateUI() { healthText.setText('Health: ' + Math.max(0, Math.floor(player.health)) + ' + Armor: ' + player.armor); scoreText.setText('Score: ' + LK.getScore()); weaponText.setText('Weapon: ' + player.weapon.charAt(0).toUpperCase() + player.weapon.slice(1)); if (isReloading) { ammoText.setText('Reloading... ' + Math.ceil(reloadTimer / 60) + 's'); } else { ammoText.setText('Ammo: ' + currentMagazineBullets + '/' + totalBullets); } } // Input handling var targetX = player.x; var targetY = player.y; var isPressed = false; var keys = { w: false, a: false, s: false, d: false }; function tryShoot(x, y) { if (player.isRangedWeapon && player.shootCooldown <= 0 && currentMagazineBullets > 0 && !isReloading) { var bullet = new Bullet(player.x, player.y, x, y, player.weaponDamage); bullet.x = player.x; bullet.y = player.y; bullets.push(bullet); game.addChild(bullet); LK.getSound('shoot').play(); currentMagazineBullets--; // Set cooldown based on weapon type switch (player.weapon) { case 'rifle': player.shootCooldown = 15; // 0.25 seconds break; } } } function tryReload() { if (isReloading || currentMagazineBullets >= bulletsPerMagazine || totalBullets <= 0) { return; } var bulletsNeeded = bulletsPerMagazine - currentMagazineBullets; var bulletsToReload = Math.min(bulletsNeeded, totalBullets); if (bulletsToReload > 0) { isReloading = true; reloadTimer = reloadTime; } } game.down = function (x, y, obj) { targetX = x; targetY = y; isPressed = true; tryShoot(x, y); }; game.move = function (x, y, obj) { targetX = x; targetY = y; // Rotate weapon to follow cursor if (player.weaponSprite) { var dx = x - player.x; var dy = y - player.y; player.weaponSprite.rotation = Math.atan2(dy, dx); } if (isPressed) { tryShoot(x, y); } }; game.up = function (x, y, obj) { isPressed = false; }; // Note: LK engine sandbox doesn't support document API // WASD movement will be handled through touch/mouse simulation // Touch controls for mobile compatibility var touchStartX = 0; var touchStartY = 0; var isTouching = false; // Initialize mall createMallLayout(); game.update = function () { gameTime++; // Move player toward cursor position continuously var moveX = 0; var moveY = 0; var dx = targetX - player.x; var dy = targetY - player.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 10) { // Only move if not very close to target var dirX = dx / distance; var dirY = dy / distance; moveX = dirX * player.speed; moveY = dirY * player.speed; } player.x += moveX; player.y += moveY; // Continuous shooting when pressed if (isPressed) { tryShoot(targetX, targetY); } // Keep player in bounds player.x = Math.max(100, Math.min(1948, player.x)); player.y = Math.max(150, Math.min(2582, player.y)); // Spawn zombies zombieSpawnTimer++; if (zombieSpawnTimer >= zombieSpawnRate) { spawnZombie(); zombieSpawnTimer = 0; } // Increase difficulty over time difficultyTimer++; if (difficultyTimer >= 1800) { // Every 30 seconds zombieSpawnRate = Math.max(60, zombieSpawnRate - 10); difficultyTimer = 0; } // Handle reload system if (isReloading) { reloadTimer--; if (reloadTimer <= 0) { var bulletsNeeded = bulletsPerMagazine - currentMagazineBullets; var bulletsToReload = Math.min(bulletsNeeded, totalBullets); currentMagazineBullets += bulletsToReload; totalBullets -= bulletsToReload; isReloading = false; } } else if (currentMagazineBullets <= 0 && totalBullets > 0) { // Auto reload when magazine is empty tryReload(); } // Check level completion if (normalZombiesKilled >= 15 && fastZombiesKilled >= 3) { // Display 'section over' message var sectionOverText = new Text2('Section Over', { size: 100, fill: 0xFFFFFF }); sectionOverText.anchor.set(0.5, 0.5); sectionOverText.x = 1024; sectionOverText.y = 1366; game.addChild(sectionOverText); // Simulate transition to next section LK.setTimeout(function () { sectionOverText.destroy(); // Simulate rescue by armored vehicle player.x = 1024; player.y = 1366; // Reset zombie kill counts for next section normalZombiesKilled = 0; fastZombiesKilled = 0; tankZombiesKilled = 0; }, 2000); } // Update game objects player.update(); for (var z = 0; z < zombies.length; z++) { zombies[z].update(); } for (var b = 0; b < bullets.length; b++) { bullets[b].update(); } // Check collisions checkCollisions(); // Update UI updateUI(); };
===================================================================
--- original.js
+++ change.js
@@ -562,25 +562,27 @@
// Initialize mall
createMallLayout();
game.update = function () {
gameTime++;
- // Move player toward cursor position when pressed
+ // Move player toward cursor position continuously
var moveX = 0;
var moveY = 0;
- if (isPressed) {
- var dx = targetX - player.x;
- var dy = targetY - player.y;
- var distance = Math.sqrt(dx * dx + dy * dy);
- if (distance > 10) {
- // Only move if not very close to target
- var dirX = dx / distance;
- var dirY = dy / distance;
- moveX = dirX * player.speed;
- moveY = dirY * player.speed;
- }
+ var dx = targetX - player.x;
+ var dy = targetY - player.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance > 10) {
+ // Only move if not very close to target
+ var dirX = dx / distance;
+ var dirY = dy / distance;
+ moveX = dirX * player.speed;
+ moveY = dirY * player.speed;
}
player.x += moveX;
player.y += moveY;
+ // Continuous shooting when pressed
+ if (isPressed) {
+ tryShoot(targetX, targetY);
+ }
// Keep player in bounds
player.x = Math.max(100, Math.min(1948, player.x));
player.y = Math.max(150, Math.min(2582, player.y));
// Spawn zombies
military knife. In-Game asset. 2d. High contrast. No shadows. miltary knife
bullet. In-Game asset. 2d. High contrast. No shadows
ak 47 . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
soldier without weopen. In-Game asset. 2d. High contrast. No shadows
healty pack middle white plus. In-Game asset. 2d. High contrast. No shadows
bulletproof armor. In-Game asset. 2d. High contrast. No shadows
redbull energy drink. In-Game asset. 2d. High contrast. No shadows
ammo box but gray. In-Game asset. 2d. High contrast. No shadows
sandwich. In-Game asset. 2d. High contrast. No shadows
brown backpack. In-Game asset. 2d. High contrast. No shadows
glock 18. In-Game asset. 2d. High contrast. No shadows
kebab. In-Game asset. 2d. High contrast. No shadows
m249. In-Game asset. 2d. High contrast. No shadows
gray cement. In-Game asset. 2d. High contrast. No shadows
biker helmet. In-Game asset. 2d. High contrast. No shadows
helmet look like soo good bullet proff. In-Game asset. 2d. High contrast. No shadows