User prompt
"Reduce the zombies' health by half." "Double the number of bullets in a single magazine and reduce the zombie damage by half."
User prompt
"Reduce the speed of the zombies and remove the money system from the game. Zombies should come continuously, and the wave system should also be removed."
User prompt
The score doesn't reset until death, and the coins are collected automatically
User prompt
When a zombie is killed, there is a chance it drops a loot box on the ground. Loot boxes do not open automatically—the player must shoot the box to open it. Once opened, the box releases a random reward, such as: 💊 Medkit: Restores a portion of the player's HP. 🔫 Ammo: Refills part of the magazine or reserve bullets. 💵 Money: Increases the player’s score. All rewards are automatically collected once the box is opened. In addition to box rewards, each zombie kill still grants $50 automatically as score.
Code edit (1 edits merged)
Please save this source code
User prompt
Zombie Siege: Stationary Survival
Initial prompt
Elbette! İşte tüm verdiğin bilgileri içeren, güncel, temiz ve geliştiriciye veya yapay zekaya doğrudan verilebilecek şekilde yazılmış **tek parça İngilizce oyun tasarım promptu**: --- **🧠 Prompt: Side-View Zombie Survival Shooter Game Design** I want to design a **2D side-view zombie survival shooter game** where the player is **stationary behind cover** on the **left side of the screen** and shoots at zombies that approach from the **right side**. The player can only **aim and shoot using the mouse**—there are no movement controls. --- ### 🎮 Core Gameplay * The player is placed behind cover and **cannot move**. * The player aims with the **mouse** and shoots zombies approaching from the right. * **Zombies walk from right to left** toward the player. * The player starts with **100 health (HP)**. * Each zombie attack deals **10 damage** if they reach the player. * The game ends when the player’s HP reaches 0. * The player earns **\$50 per zombie kill**. This money is used purely as a **score system**. * The goal is to **survive as long as possible** and achieve the **highest score**. --- ### 🧟 Zombie System * Zombies spawn in waves and slowly walk toward the player. * **Zombie health starts at 15 HP** and increases by **+5 HP per level**: * Level 1: 15 HP * Level 2: 20 HP * Level 3: 25 HP * etc. * The **number of zombies starts at 5 in Level 1** and **increases by +1 with each level**: * Level 1: 5 zombies * Level 2: 6 zombies * Level 3: 7 zombies * etc. * This scaling system increases difficulty steadily while keeping the 2D side-view manageable. --- ### 🎁 Loot and Reward System * When a zombie is killed, there is a chance for a **loot box** to drop. * Loot boxes may contain: * 💊 **Medkits**: Restore a portion of the player’s HP. * 🔫 **Ammo**: Refill bullets. * 💵 **Money**: Adds to the player’s score. * **Ammo management** is important. Players must reload when the magazine is empty. --- ### 🔫 Weapon Progression System The player starts with a basic weapon and gains new weapons every **5 levels**. Each weapon has different damage and magazine size: 1. **Levels 1–4** * Weapon: Pistol * Damage per bullet: 5 * Magazine: 30 bullets 2. **Levels 5–9** * Weapon: Dual Pistols * Damage: 5 * Magazine: 60 bullets 3. **Levels 10–14** * Weapon: SMG * Damage: 7 * Magazine: 40 bullets 4. **Levels 15–19** * Weapon: Faster SMG (different look) * Damage: 8 * Magazine: 50 bullets 5. **Levels 20–24** * Weapon: Shotgun * Fires: 4 pellets per shot (area damage) * Damage per pellet: 3 * Magazine: 20 shells 6. **Levels 25–29** * Weapon: Advanced Shotgun * Fires: 5 pellets per shot * Damage per pellet: 4 * Magazine: 30 shells 7. **Levels 30–34** * Weapon: M16 Assault Rifle * Damage: 30 per bullet * Magazine: 30 bullets 8. **Levels 35+** * Weapon: AK-47 * Damage: 35 per bullet * Magazine: 30 bullets --- ### 🎯 Summary * **Genre**: 2D Side-View Survival Shooter * **Perspective**: Player is visible on-screen, stationary, on the left side * **Mechanics**: Mouse-only aiming and shooting * **Enemy Behavior**: Zombies walk from right to left * **Progression**: Increasing zombie health and quantity per wave * **Goal**: Stay alive, manage ammo and HP, kill zombies, and achieve the highest score ---
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Bullet class var Bullet = Container.expand(function () { var self = Container.call(this); // Attach bullet asset (yellow box) var bulletSprite = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 32; self.damage = 1; self.update = function () { self.x += self.speed; }; return self; }); // LootBox class var LootBox = Container.expand(function () { var self = Container.call(this); // Attach lootbox asset (orange ellipse) var lootSprite = self.attachAsset('lootbox', { anchorX: 0.5, anchorY: 0.5 }); self.type = 'ammo'; // 'ammo', 'medkit', 'money' self.value = 1; self.speed = 2.5; self.update = function () { self.x -= self.speed; }; return self; }); // Player class (stationary) var Player = Container.expand(function () { var self = Container.call(this); // Attach player asset (red box) var playerSprite = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); // Gun barrel position (relative to player) self.getGunPos = function () { // Gun at right edge, center vertically return { x: self.x + playerSprite.width / 2, y: self.y }; }; return self; }); // Zombie class var Zombie = Container.expand(function () { var self = Container.call(this); // Attach zombie asset (box, greenish) var zombieSprite = self.attachAsset('zombie', { anchorX: 0.5, anchorY: 1 }); // Set up stats self.maxHealth = 1; self.health = 1; self.speed = 2; self.reward = 10; // money for killing // Health bar var healthBar = self.addChild(LK.getAsset('zombieHealthBar', { anchorX: 0.5, anchorY: 0.5, width: 60, height: 10, color: 0xff0000 })); healthBar.y = -zombieSprite.height + 10; // Update health bar self.updateHealthBar = function () { healthBar.width = 60 * (self.health / self.maxHealth); }; // Called every tick self.update = function () { self.x -= self.speed; // Health bar follows self.updateHealthBar(); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x222222 }); /**** * Game Code ****/ // --- Game State --- // --- Asset Initialization --- var player = null; var bullets = []; var zombies = []; var lootboxes = []; var money = 0; var ammo = 10; var maxAmmo = 10; var health = 5; var maxHealth = 5; var level = 1; var zombiesToSpawn = 0; var zombiesSpawned = 0; var zombiesKilled = 0; var spawnTimer = 0; var reloadTimer = 0; var isReloading = false; var weaponIndex = 0; var weapons = [{ name: "Pistol", damage: 1, ammo: 10, reload: 60, bulletSpeed: 32, color: 0xf7e12b }, { name: "SMG", damage: 1, ammo: 20, reload: 40, bulletSpeed: 36, color: 0x00bfff }, { name: "Shotgun", damage: 3, ammo: 5, reload: 90, bulletSpeed: 28, color: 0xffffff }]; var unlockedWeapons = 1; // Start with 1 weapon // --- UI Elements --- var scoreTxt = new Text2('Score: 0', { size: 80, fill: "#fff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var moneyTxt = new Text2('$0', { size: 60, fill: 0xFFE066 }); moneyTxt.anchor.set(0, 0); LK.gui.topRight.addChild(moneyTxt); var ammoTxt = new Text2('Ammo: 10/10', { size: 60, fill: "#fff" }); ammoTxt.anchor.set(0, 0); LK.gui.bottomLeft.addChild(ammoTxt); var healthTxt = new Text2('♥♥♥♥♥', { size: 60, fill: 0xFF4D4D }); healthTxt.anchor.set(0, 1); LK.gui.bottom.addChild(healthTxt); var weaponTxt = new Text2('Pistol', { size: 60, fill: "#fff" }); weaponTxt.anchor.set(0.5, 0); LK.gui.bottom.addChild(weaponTxt); // --- Helper Functions --- function updateUI() { scoreTxt.setText('Score: ' + zombiesKilled); moneyTxt.setText('$' + money); ammoTxt.setText('Ammo: ' + ammo + '/' + maxAmmo); var hearts = ''; for (var i = 0; i < health; i++) hearts += '♥'; for (var i = health; i < maxHealth; i++) hearts += '♡'; healthTxt.setText(hearts); weaponTxt.setText(weapons[weaponIndex].name); } function startLevel(lvl) { level = lvl; zombiesToSpawn = 5 + Math.floor(level * 1.5); zombiesSpawned = 0; spawnTimer = 0; zombiesKilled = 0; // Unlock new weapon every 5 levels if (level % 5 === 0 && unlockedWeapons < weapons.length) { unlockedWeapons++; } // Increase difficulty // (handled in spawnZombie) } function spawnZombie() { var z = new Zombie(); // Position at right edge, random y z.x = 2048 + 80; z.y = 400 + Math.floor(Math.random() * (2732 - 800)); // Scale health and speed with level z.maxHealth = 2 + Math.floor(level * 0.7); z.health = z.maxHealth; z.speed = 2 + Math.random() * 0.5 + level * 0.1; z.reward = 10 + level * 2; zombies.push(z); game.addChild(z); zombiesSpawned++; } function spawnLootBox(x, y) { var loot = new LootBox(); loot.x = x; loot.y = y; // Randomize type var r = Math.random(); if (r < 0.4) { loot.type = 'ammo'; loot.value = 5 + Math.floor(Math.random() * 5); } else if (r < 0.7) { loot.type = 'medkit'; loot.value = 1; } else { loot.type = 'money'; loot.value = 20 + Math.floor(Math.random() * 20); } lootboxes.push(loot); game.addChild(loot); } // --- Game Setup --- player = new Player(); player.x = 180; player.y = 2732 / 2; game.addChild(player); // --- Input Handling --- var lastShotTick = 0; var dragNode = null; // Mouse/touch move: aim gun game.move = function (x, y, obj) { // No drag, just aiming // Optionally, could rotate gun sprite, but for now, just use for shooting }; // Mouse/touch down: shoot game.down = function (x, y, obj) { // Only shoot if not reloading if (isReloading) return; if (ammo <= 0) { // Start reload isReloading = true; reloadTimer = 0; return; } // Fire bullet var gunPos = player.getGunPos(); var b = new Bullet(); b.x = gunPos.x; b.y = gunPos.y; // Aim: calculate angle to (x, y) var dx = x - gunPos.x; var dy = y - gunPos.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist === 0) dist = 1; b.speed = weapons[weaponIndex].bulletSpeed; b.damage = weapons[weaponIndex].damage; // Set bullet direction b.vx = b.speed * (dx / dist); b.vy = b.speed * (dy / dist); // Overwrite update to use vx/vy b.update = function () { b.x += b.vx; b.y += b.vy; }; bullets.push(b); game.addChild(b); ammo--; updateUI(); }; // Mouse/touch up: nothing game.up = function (x, y, obj) {}; // --- Weapon Switching (tap weapon name to switch) --- weaponTxt.down = function (x, y, obj) { weaponIndex = (weaponIndex + 1) % unlockedWeapons; // Update maxAmmo and ammo maxAmmo = weapons[weaponIndex].ammo; ammo = maxAmmo; updateUI(); }; // --- Main Game Loop --- game.update = function () { // --- Spawning zombies --- if (zombiesSpawned < zombiesToSpawn) { spawnTimer++; if (spawnTimer > 60) { // spawn every 1s spawnZombie(); spawnTimer = 0; } } // --- Bullets update --- for (var i = bullets.length - 1; i >= 0; i--) { var b = bullets[i]; b.update(); // Remove if off screen if (b.x > 2048 + 100 || b.y < -100 || b.y > 2732 + 100) { b.destroy(); bullets.splice(i, 1); continue; } // Check collision with zombies for (var j = zombies.length - 1; j >= 0; j--) { var z = zombies[j]; if (b.intersects(z)) { z.health -= b.damage; if (z.health <= 0) { // Zombie dies money += z.reward; zombiesKilled++; spawnLootBox(z.x, z.y - 40); z.destroy(); zombies.splice(j, 1); } b.destroy(); bullets.splice(i, 1); break; } } } // --- Zombies update --- for (var i = zombies.length - 1; i >= 0; i--) { var z = zombies[i]; z.update(); // If zombie reaches player if (z.x < player.x + 60) { // Damage player health--; LK.effects.flashObject(player, 0xff0000, 400); z.destroy(); zombies.splice(i, 1); if (health <= 0) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } } } // --- Lootboxes update --- for (var i = lootboxes.length - 1; i >= 0; i--) { var l = lootboxes[i]; l.update(); // If off screen if (l.x < -100) { l.destroy(); lootboxes.splice(i, 1); continue; } // If player collects if (l.intersects(player)) { if (l.type === 'ammo') { ammo += l.value; if (ammo > maxAmmo) ammo = maxAmmo; } else if (l.type === 'medkit') { health += l.value; if (health > maxHealth) health = maxHealth; } else if (l.type === 'money') { money += l.value; } l.destroy(); lootboxes.splice(i, 1); } } // --- Reloading --- if (isReloading) { reloadTimer++; if (reloadTimer > weapons[weaponIndex].reload) { isReloading = false; ammo = maxAmmo; updateUI(); } } // --- Level progression --- if (zombiesSpawned === zombiesToSpawn && zombies.length === 0) { // Next level startLevel(level + 1); } updateUI(); }; // --- Start Game --- money = 0; ammo = weapons[weaponIndex].ammo; maxAmmo = weapons[weaponIndex].ammo; health = maxHealth; zombiesKilled = 0; unlockedWeapons = 1; weaponIndex = 0; startLevel(1); updateUI();
===================================================================
--- original.js
+++ change.js