User prompt
Develop a 2D top-down zombie survival maze game for PC. 🎮 Core Concept: The player controls a mysterious survivor with a bird’s head, trapped in a dark, maze-like facility filled with zombies. The objective is to eliminate as many zombies as possible and escape the labyrinth alive. Players earn points only by killing zombies — survival time does not increase score. 📌 Key Features: Top-down camera for full map awareness Maze-based level: tight corridors, dead ends, hidden paths Unlimited bullets, but player must manage space and avoid being cornered Zombies spawn continuously and become stronger over time A hidden escape exit allows players to end the game by escaping Skor sadece zombileri öldürdükçe artar (Score increases only by killing zombies) 🕹️ Controls (PC only): Move: W / A / S / D Aim: Mouse Cursor Shoot: Left Mouse Button 🧾 UI and Screens: Main Menu: Start Game, How to Play, Exit How to Play screen: Clear explanation of controls and objectives Game Over screen: Display total zombies killed (score) Minimalist HUD showing Kill Count, Health, and optional Map 🎨 Art Style: Stylized pixel-art or simple cartoon visuals Atmospheric lighting in maze corridors Placeholder sprites acceptable in prototype 🔧 Development Notes: Modular structure for adding enemy types, power-ups, or new maze levels Designed only for PC, with keyboard + mouse control Game ends either on death or successful escape
User prompt
Design a 2D top-down zombie survival maze game for PC only. 🎮 Core Concept: The player controls a mysterious survivor with a bird’s head, trapped in an abandoned labyrinth filled with undead threats. The objective is to navigate the maze, eliminate zombies, and ultimately escape through a hidden exit. There is no ammo limit — survival depends on reflexes, positioning, and map knowledge. 📌 Features: Top-down camera with clear visibility of the maze environment Labyrinth-style map: narrow corridors, blocked paths, multiple routes Waves of zombies increase in difficulty over time The player must find the correct path to escape while surviving constant pressure Escape zone is hidden and may change position in each round (optional) No ammo limit, but limited health — getting surrounded is fatal 🕹️ Controls (PC only): Move: W / A / S / D Shoot: Left Mouse Button Aim: Mouse Cursor 🧾 UI Elements: Main Menu with Start Game, How to Play, Exit "How to Play" screen explaining controls and objective Game Over screen showing time survived and zombies eliminated Clean, minimalist interface, designed for PC experience 🎨 Style: Simple pixel-art or cartoon aesthetic Dark and atmospheric color palette Placeholder assets allowed for initial build 💡 Expansion Potential: Dynamic lighting in the maze Power-ups and keys to unlock shortcut doors Multiple character types (future update) Global leaderboard for fastest escapes / most kills This game should be optimized for PC with keyboard + mouse controls only. Mobile support is not required.
User prompt
Create a 2D top-down zombie survival game with the following features: The main character has a bird’s head and can move freely. The map is designed as a maze (labyrinth) filled with paths, dead ends, and multiple routes. The player must survive as long as possible and optionally escape the maze to win. The character can shoot without ammo limits (infinite bullets). Zombies spawn randomly and chase the player with increasing difficulty. The camera uses a top-down view to show the entire environment from above. UI and Features: Include an English Main Menu with: Start Game, How to Play, Exit Add a "How to Play" screen explaining the controls and the escape objective Game Over screen showing survival time and option to restart Use placeholder sprites for character, zombies, and maze environment Art style: simple cartoon or pixel-art The game should work on both mobile and PC, with on-screen buttons for mobile Make the structure modular and beginner-friendly, allowing future expansion (more enemies, new weapons, timed escape, etc.).
User prompt
Create a 2D top-down zombie survival game with the following features: The main character has a bird’s head and can move freely. The map is designed as a maze (labyrinth) filled with paths, dead ends, and multiple routes. The player must survive as long as possible and optionally escape the maze to win. The character can shoot without ammo limits (infinite bullets). Zombies spawn randomly and chase the player with increasing difficulty. The camera uses a top-down view to show the entire environment from above. UI and Features: Include an English Main Menu with: Start Game, How to Play, Exit Add a "How to Play" screen explaining the controls and the escape objective Game Over screen showing survival time and option to restart Use placeholder sprites for character, zombies, and maze environment Art style: simple cartoon or pixel-art The game should work on both mobile and PC, with on-screen buttons for mobile Make the structure modular and beginner-friendly, allowing future expansion (more enemies, new weapons, timed escape, etc.)
User prompt
Create a 2D side-scrolling zombie survival game where the main character has a bird’s head. The character can move freely and shoot without ammo limits. Include a "How to Play" UI screen that clearly explains the controls and gameplay mechanics.
User prompt
Create a 2D side-scrolling zombie survival game where the character can move freely and shoot without ammo limits. Include a "How to Play" UI screen that clearly explains the controls and gameplay mechanics.
Code edit (1 edits merged)
Please save this source code
User prompt
Zombie Survival Rush
Initial prompt
Create a 2D side-scrolling zombie survival game that works on both mobile devices and PC. The player must survive as long as possible against endless waves of zombies. The game should include a scoring system based on survival time and zombie kills. Features: English user interface Main Menu with: Start Game, How to Play, High Scores, Exit “How to Play” screen explaining controls: PC: Move (A/D), Jump (Space), Shoot (Left Click), Change Weapon (1/2/3) Mobile: On-screen buttons for move, jump, shoot, and switch weapon Increasing difficulty with time (zombies become stronger and faster) Game Over screen showing score and a "Try Again" button Health and weapon pickups Responsive UI that works on both PC and mobile screen sizes Use placeholder sprites for player, zombies, and background Simple, cartoon or pixel-art style Beginner-friendly and modular structure for future expansion
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 12;
self.damage = 25;
self.direction = 1; // 1 for right, -1 for left
self.update = function () {
self.x += self.speed * self.direction;
};
return self;
});
var HealthPack = Container.expand(function () {
var self = Container.call(this);
var healthGraphics = self.attachAsset('healthPack', {
anchorX: 0.5,
anchorY: 0.5
});
self.healAmount = 30;
self.update = function () {
// Simple floating animation
self.y += Math.sin(LK.ticks * 0.1) * 0.5;
// Check pickup
if (self.intersects(player)) {
player.heal(self.healAmount);
LK.getSound('pickup').play();
self.collected = true;
}
};
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 1.0
});
self.health = 100;
self.maxHealth = 100;
self.speed = 8;
self.jumpPower = 15;
self.velocityY = 0;
self.onGround = true;
self.weapon = 1;
self.maxWeapon = 3;
self.takeDamage = function (damage) {
self.health -= damage;
if (self.health <= 0) {
self.health = 0;
gameOver = true;
}
// Flash red when taking damage
LK.effects.flashObject(self, 0xFF0000, 500);
};
self.heal = function (amount) {
self.health = Math.min(self.maxHealth, self.health + amount);
};
self.upgradeWeapon = function () {
if (self.weapon < self.maxWeapon) {
self.weapon++;
}
};
self.update = function () {
// Apply gravity
if (!self.onGround) {
self.velocityY += 0.8;
}
// Update position
self.y += self.velocityY;
// Ground collision
if (self.y >= groundY) {
self.y = groundY;
self.velocityY = 0;
self.onGround = true;
}
};
return self;
});
var WeaponPickup = Container.expand(function () {
var self = Container.call(this);
var weaponGraphics = self.attachAsset('weaponPickup', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Simple floating animation
self.y += Math.sin(LK.ticks * 0.1) * 0.5;
// Check pickup
if (self.intersects(player)) {
player.upgradeWeapon();
LK.getSound('pickup').play();
self.collected = true;
}
};
return self;
});
var Zombie = Container.expand(function () {
var self = Container.call(this);
var zombieGraphics = self.attachAsset('zombie', {
anchorX: 0.5,
anchorY: 1.0
});
self.health = 50;
self.speed = 2;
self.damage = 20;
self.lastAttackTime = 0;
self.takeDamage = function (damage) {
self.health -= damage;
LK.effects.flashObject(self, 0xFFFFFF, 200);
if (self.health <= 0) {
return true; // Zombie is dead
}
return false;
};
self.update = function () {
// Move towards player
if (player.x > self.x) {
self.x += self.speed;
} else {
self.x -= self.speed;
}
// Check collision with player
if (self.intersects(player)) {
var currentTime = LK.ticks;
if (currentTime - self.lastAttackTime > 60) {
// Attack every second
player.takeDamage(self.damage);
self.lastAttackTime = currentTime;
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Game variables
var player;
var zombies = [];
var bullets = [];
var healthPacks = [];
var weaponPickups = [];
var gameOver = false;
var score = 0;
var waveNumber = 1;
var zombieSpawnTimer = 0;
var pickupSpawnTimer = 0;
var groundY = 2732 - 150;
// Movement controls
var moveLeft = false;
var moveRight = false;
var shooting = false;
var shootTimer = 0;
// Create ground
var ground = game.addChild(LK.getAsset('ground', {
anchorX: 0,
anchorY: 0,
x: 0,
y: groundY + 50
}));
// Create player
player = game.addChild(new Player());
player.x = 300;
player.y = groundY;
// UI Elements
var scoreText = new Text2('Score: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreText.anchor.set(0, 0);
scoreText.x = 150;
scoreText.y = 50;
LK.gui.topLeft.addChild(scoreText);
var healthText = new Text2('Health: 100', {
size: 60,
fill: 0xFF0000
});
healthText.anchor.set(0, 0);
healthText.x = 150;
healthText.y = 120;
LK.gui.topLeft.addChild(healthText);
var waveText = new Text2('Wave: 1', {
size: 60,
fill: 0xFFFF00
});
waveText.anchor.set(1, 0);
LK.gui.topRight.addChild(waveText);
// Control buttons for mobile
var leftButton = LK.getAsset('player', {
width: 100,
height: 100,
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.3
});
leftButton.x = 100;
leftButton.y = 2600;
LK.gui.addChild(leftButton);
var rightButton = LK.getAsset('player', {
width: 100,
height: 100,
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.3
});
rightButton.x = 250;
rightButton.y = 2600;
LK.gui.addChild(rightButton);
var jumpButton = LK.getAsset('player', {
width: 100,
height: 100,
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.3
});
jumpButton.x = 1900;
jumpButton.y = 2500;
LK.gui.addChild(jumpButton);
var shootButton = LK.getAsset('bullet', {
width: 100,
height: 100,
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.3
});
shootButton.x = 1900;
shootButton.y = 2600;
LK.gui.addChild(shootButton);
// Button event handlers
leftButton.down = function () {
moveLeft = true;
};
leftButton.up = function () {
moveLeft = false;
};
rightButton.down = function () {
moveRight = true;
};
rightButton.up = function () {
moveRight = false;
};
jumpButton.down = function () {
if (player.onGround) {
player.velocityY = -player.jumpPower;
player.onGround = false;
}
};
shootButton.down = function () {
shooting = true;
};
shootButton.up = function () {
shooting = false;
};
// Game event handlers
game.down = function (x, y, obj) {
// Handle shooting anywhere on screen
if (x > 1024) {
// Right side of screen
shooting = true;
}
};
game.up = function (x, y, obj) {
shooting = false;
};
// Spawn functions
function spawnZombie() {
var zombie = new Zombie();
zombie.x = Math.random() < 0.5 ? -50 : 2098; // Spawn from left or right edge
zombie.y = groundY;
// Scale difficulty based on wave
zombie.health += (waveNumber - 1) * 10;
zombie.speed += (waveNumber - 1) * 0.5;
zombie.damage += (waveNumber - 1) * 5;
zombies.push(zombie);
game.addChild(zombie);
}
function spawnHealthPack() {
var healthPack = new HealthPack();
healthPack.x = Math.random() * 1800 + 124;
healthPack.y = groundY - 50;
healthPacks.push(healthPack);
game.addChild(healthPack);
}
function spawnWeaponPickup() {
var weaponPickup = new WeaponPickup();
weaponPickup.x = Math.random() * 1800 + 124;
weaponPickup.y = groundY - 50;
weaponPickups.push(weaponPickup);
game.addChild(weaponPickup);
}
function shootBullet() {
var bullet = new Bullet();
bullet.x = player.x;
bullet.y = player.y - 40;
bullet.damage = 25 * player.weapon; // More damage with better weapons
// Find nearest zombie to aim at
var nearestZombie = null;
var nearestDistance = Infinity;
for (var i = 0; i < zombies.length; i++) {
var distance = Math.abs(zombies[i].x - player.x);
if (distance < nearestDistance) {
nearestDistance = distance;
nearestZombie = zombies[i];
}
}
if (nearestZombie) {
bullet.direction = nearestZombie.x > player.x ? 1 : -1;
} else {
bullet.direction = 1; // Default right
}
bullets.push(bullet);
game.addChild(bullet);
LK.getSound('shoot').play();
}
// Main game update
game.update = function () {
if (gameOver) {
LK.showGameOver();
return;
}
// Update score based on survival time
score += 1;
LK.setScore(score);
// Handle player movement
if (moveLeft && player.x > 50) {
player.x -= player.speed;
}
if (moveRight && player.x < 1998) {
player.x += player.speed;
}
// Handle shooting
if (shooting && LK.ticks - shootTimer > 60 / player.weapon) {
// Faster shooting with better weapons
shootBullet();
shootTimer = LK.ticks;
}
// Spawn zombies
zombieSpawnTimer++;
var spawnRate = Math.max(60 - waveNumber * 5, 20); // Faster spawning each wave
if (zombieSpawnTimer >= spawnRate) {
spawnZombie();
zombieSpawnTimer = 0;
}
// Spawn pickups occasionally
pickupSpawnTimer++;
if (pickupSpawnTimer >= 600) {
// Every 10 seconds
if (Math.random() < 0.7) {
spawnHealthPack();
} else {
spawnWeaponPickup();
}
pickupSpawnTimer = 0;
}
// Update bullets and check collisions
for (var i = bullets.length - 1; i >= 0; i--) {
var bullet = bullets[i];
// Check if bullet is off screen
if (bullet.x < -50 || bullet.x > 2098) {
bullet.destroy();
bullets.splice(i, 1);
continue;
}
// Check bullet-zombie collisions
var hit = false;
for (var j = zombies.length - 1; j >= 0; j--) {
var zombie = zombies[j];
if (bullet.intersects(zombie)) {
if (zombie.takeDamage(bullet.damage)) {
// Zombie died
score += 50;
LK.getSound('zombieHit').play();
zombie.destroy();
zombies.splice(j, 1);
}
bullet.destroy();
bullets.splice(i, 1);
hit = true;
break;
}
}
}
// Update health packs
for (var i = healthPacks.length - 1; i >= 0; i--) {
var healthPack = healthPacks[i];
if (healthPack.collected) {
healthPack.destroy();
healthPacks.splice(i, 1);
}
}
// Update weapon pickups
for (var i = weaponPickups.length - 1; i >= 0; i--) {
var weaponPickup = weaponPickups[i];
if (weaponPickup.collected) {
weaponPickup.destroy();
weaponPickups.splice(i, 1);
}
}
// Update wave progression
if (LK.ticks % 1800 === 0) {
// Every 30 seconds
waveNumber++;
}
// Update UI
scoreText.setText('Score: ' + score);
healthText.setText('Health: ' + player.health);
waveText.setText('Wave: ' + waveNumber);
// Check win condition (survive for a very long time)
if (score >= 10000) {
LK.showYouWin();
}
}; ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,430 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var Bullet = Container.expand(function () {
+ var self = Container.call(this);
+ var bulletGraphics = self.attachAsset('bullet', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 12;
+ self.damage = 25;
+ self.direction = 1; // 1 for right, -1 for left
+ self.update = function () {
+ self.x += self.speed * self.direction;
+ };
+ return self;
+});
+var HealthPack = Container.expand(function () {
+ var self = Container.call(this);
+ var healthGraphics = self.attachAsset('healthPack', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.healAmount = 30;
+ self.update = function () {
+ // Simple floating animation
+ self.y += Math.sin(LK.ticks * 0.1) * 0.5;
+ // Check pickup
+ if (self.intersects(player)) {
+ player.heal(self.healAmount);
+ LK.getSound('pickup').play();
+ self.collected = true;
+ }
+ };
+ return self;
+});
+var Player = Container.expand(function () {
+ var self = Container.call(this);
+ var playerGraphics = self.attachAsset('player', {
+ anchorX: 0.5,
+ anchorY: 1.0
+ });
+ self.health = 100;
+ self.maxHealth = 100;
+ self.speed = 8;
+ self.jumpPower = 15;
+ self.velocityY = 0;
+ self.onGround = true;
+ self.weapon = 1;
+ self.maxWeapon = 3;
+ self.takeDamage = function (damage) {
+ self.health -= damage;
+ if (self.health <= 0) {
+ self.health = 0;
+ gameOver = true;
+ }
+ // Flash red when taking damage
+ LK.effects.flashObject(self, 0xFF0000, 500);
+ };
+ self.heal = function (amount) {
+ self.health = Math.min(self.maxHealth, self.health + amount);
+ };
+ self.upgradeWeapon = function () {
+ if (self.weapon < self.maxWeapon) {
+ self.weapon++;
+ }
+ };
+ self.update = function () {
+ // Apply gravity
+ if (!self.onGround) {
+ self.velocityY += 0.8;
+ }
+ // Update position
+ self.y += self.velocityY;
+ // Ground collision
+ if (self.y >= groundY) {
+ self.y = groundY;
+ self.velocityY = 0;
+ self.onGround = true;
+ }
+ };
+ return self;
+});
+var WeaponPickup = Container.expand(function () {
+ var self = Container.call(this);
+ var weaponGraphics = self.attachAsset('weaponPickup', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.update = function () {
+ // Simple floating animation
+ self.y += Math.sin(LK.ticks * 0.1) * 0.5;
+ // Check pickup
+ if (self.intersects(player)) {
+ player.upgradeWeapon();
+ LK.getSound('pickup').play();
+ self.collected = true;
+ }
+ };
+ return self;
+});
+var Zombie = Container.expand(function () {
+ var self = Container.call(this);
+ var zombieGraphics = self.attachAsset('zombie', {
+ anchorX: 0.5,
+ anchorY: 1.0
+ });
+ self.health = 50;
+ self.speed = 2;
+ self.damage = 20;
+ self.lastAttackTime = 0;
+ self.takeDamage = function (damage) {
+ self.health -= damage;
+ LK.effects.flashObject(self, 0xFFFFFF, 200);
+ if (self.health <= 0) {
+ return true; // Zombie is dead
+ }
+ return false;
+ };
+ self.update = function () {
+ // Move towards player
+ if (player.x > self.x) {
+ self.x += self.speed;
+ } else {
+ self.x -= self.speed;
+ }
+ // Check collision with player
+ if (self.intersects(player)) {
+ var currentTime = LK.ticks;
+ if (currentTime - self.lastAttackTime > 60) {
+ // Attack every second
+ player.takeDamage(self.damage);
+ self.lastAttackTime = currentTime;
+ }
+ }
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x87CEEB
+});
+
+/****
+* Game Code
+****/
+// Game variables
+var player;
+var zombies = [];
+var bullets = [];
+var healthPacks = [];
+var weaponPickups = [];
+var gameOver = false;
+var score = 0;
+var waveNumber = 1;
+var zombieSpawnTimer = 0;
+var pickupSpawnTimer = 0;
+var groundY = 2732 - 150;
+// Movement controls
+var moveLeft = false;
+var moveRight = false;
+var shooting = false;
+var shootTimer = 0;
+// Create ground
+var ground = game.addChild(LK.getAsset('ground', {
+ anchorX: 0,
+ anchorY: 0,
+ x: 0,
+ y: groundY + 50
+}));
+// Create player
+player = game.addChild(new Player());
+player.x = 300;
+player.y = groundY;
+// UI Elements
+var scoreText = new Text2('Score: 0', {
+ size: 60,
+ fill: 0xFFFFFF
+});
+scoreText.anchor.set(0, 0);
+scoreText.x = 150;
+scoreText.y = 50;
+LK.gui.topLeft.addChild(scoreText);
+var healthText = new Text2('Health: 100', {
+ size: 60,
+ fill: 0xFF0000
+});
+healthText.anchor.set(0, 0);
+healthText.x = 150;
+healthText.y = 120;
+LK.gui.topLeft.addChild(healthText);
+var waveText = new Text2('Wave: 1', {
+ size: 60,
+ fill: 0xFFFF00
+});
+waveText.anchor.set(1, 0);
+LK.gui.topRight.addChild(waveText);
+// Control buttons for mobile
+var leftButton = LK.getAsset('player', {
+ width: 100,
+ height: 100,
+ anchorX: 0.5,
+ anchorY: 0.5,
+ alpha: 0.3
+});
+leftButton.x = 100;
+leftButton.y = 2600;
+LK.gui.addChild(leftButton);
+var rightButton = LK.getAsset('player', {
+ width: 100,
+ height: 100,
+ anchorX: 0.5,
+ anchorY: 0.5,
+ alpha: 0.3
+});
+rightButton.x = 250;
+rightButton.y = 2600;
+LK.gui.addChild(rightButton);
+var jumpButton = LK.getAsset('player', {
+ width: 100,
+ height: 100,
+ anchorX: 0.5,
+ anchorY: 0.5,
+ alpha: 0.3
+});
+jumpButton.x = 1900;
+jumpButton.y = 2500;
+LK.gui.addChild(jumpButton);
+var shootButton = LK.getAsset('bullet', {
+ width: 100,
+ height: 100,
+ anchorX: 0.5,
+ anchorY: 0.5,
+ alpha: 0.3
+});
+shootButton.x = 1900;
+shootButton.y = 2600;
+LK.gui.addChild(shootButton);
+// Button event handlers
+leftButton.down = function () {
+ moveLeft = true;
+};
+leftButton.up = function () {
+ moveLeft = false;
+};
+rightButton.down = function () {
+ moveRight = true;
+};
+rightButton.up = function () {
+ moveRight = false;
+};
+jumpButton.down = function () {
+ if (player.onGround) {
+ player.velocityY = -player.jumpPower;
+ player.onGround = false;
+ }
+};
+shootButton.down = function () {
+ shooting = true;
+};
+shootButton.up = function () {
+ shooting = false;
+};
+// Game event handlers
+game.down = function (x, y, obj) {
+ // Handle shooting anywhere on screen
+ if (x > 1024) {
+ // Right side of screen
+ shooting = true;
+ }
+};
+game.up = function (x, y, obj) {
+ shooting = false;
+};
+// Spawn functions
+function spawnZombie() {
+ var zombie = new Zombie();
+ zombie.x = Math.random() < 0.5 ? -50 : 2098; // Spawn from left or right edge
+ zombie.y = groundY;
+ // Scale difficulty based on wave
+ zombie.health += (waveNumber - 1) * 10;
+ zombie.speed += (waveNumber - 1) * 0.5;
+ zombie.damage += (waveNumber - 1) * 5;
+ zombies.push(zombie);
+ game.addChild(zombie);
+}
+function spawnHealthPack() {
+ var healthPack = new HealthPack();
+ healthPack.x = Math.random() * 1800 + 124;
+ healthPack.y = groundY - 50;
+ healthPacks.push(healthPack);
+ game.addChild(healthPack);
+}
+function spawnWeaponPickup() {
+ var weaponPickup = new WeaponPickup();
+ weaponPickup.x = Math.random() * 1800 + 124;
+ weaponPickup.y = groundY - 50;
+ weaponPickups.push(weaponPickup);
+ game.addChild(weaponPickup);
+}
+function shootBullet() {
+ var bullet = new Bullet();
+ bullet.x = player.x;
+ bullet.y = player.y - 40;
+ bullet.damage = 25 * player.weapon; // More damage with better weapons
+ // Find nearest zombie to aim at
+ var nearestZombie = null;
+ var nearestDistance = Infinity;
+ for (var i = 0; i < zombies.length; i++) {
+ var distance = Math.abs(zombies[i].x - player.x);
+ if (distance < nearestDistance) {
+ nearestDistance = distance;
+ nearestZombie = zombies[i];
+ }
+ }
+ if (nearestZombie) {
+ bullet.direction = nearestZombie.x > player.x ? 1 : -1;
+ } else {
+ bullet.direction = 1; // Default right
+ }
+ bullets.push(bullet);
+ game.addChild(bullet);
+ LK.getSound('shoot').play();
+}
+// Main game update
+game.update = function () {
+ if (gameOver) {
+ LK.showGameOver();
+ return;
+ }
+ // Update score based on survival time
+ score += 1;
+ LK.setScore(score);
+ // Handle player movement
+ if (moveLeft && player.x > 50) {
+ player.x -= player.speed;
+ }
+ if (moveRight && player.x < 1998) {
+ player.x += player.speed;
+ }
+ // Handle shooting
+ if (shooting && LK.ticks - shootTimer > 60 / player.weapon) {
+ // Faster shooting with better weapons
+ shootBullet();
+ shootTimer = LK.ticks;
+ }
+ // Spawn zombies
+ zombieSpawnTimer++;
+ var spawnRate = Math.max(60 - waveNumber * 5, 20); // Faster spawning each wave
+ if (zombieSpawnTimer >= spawnRate) {
+ spawnZombie();
+ zombieSpawnTimer = 0;
+ }
+ // Spawn pickups occasionally
+ pickupSpawnTimer++;
+ if (pickupSpawnTimer >= 600) {
+ // Every 10 seconds
+ if (Math.random() < 0.7) {
+ spawnHealthPack();
+ } else {
+ spawnWeaponPickup();
+ }
+ pickupSpawnTimer = 0;
+ }
+ // Update bullets and check collisions
+ for (var i = bullets.length - 1; i >= 0; i--) {
+ var bullet = bullets[i];
+ // Check if bullet is off screen
+ if (bullet.x < -50 || bullet.x > 2098) {
+ bullet.destroy();
+ bullets.splice(i, 1);
+ continue;
+ }
+ // Check bullet-zombie collisions
+ var hit = false;
+ for (var j = zombies.length - 1; j >= 0; j--) {
+ var zombie = zombies[j];
+ if (bullet.intersects(zombie)) {
+ if (zombie.takeDamage(bullet.damage)) {
+ // Zombie died
+ score += 50;
+ LK.getSound('zombieHit').play();
+ zombie.destroy();
+ zombies.splice(j, 1);
+ }
+ bullet.destroy();
+ bullets.splice(i, 1);
+ hit = true;
+ break;
+ }
+ }
+ }
+ // Update health packs
+ for (var i = healthPacks.length - 1; i >= 0; i--) {
+ var healthPack = healthPacks[i];
+ if (healthPack.collected) {
+ healthPack.destroy();
+ healthPacks.splice(i, 1);
+ }
+ }
+ // Update weapon pickups
+ for (var i = weaponPickups.length - 1; i >= 0; i--) {
+ var weaponPickup = weaponPickups[i];
+ if (weaponPickup.collected) {
+ weaponPickup.destroy();
+ weaponPickups.splice(i, 1);
+ }
+ }
+ // Update wave progression
+ if (LK.ticks % 1800 === 0) {
+ // Every 30 seconds
+ waveNumber++;
+ }
+ // Update UI
+ scoreText.setText('Score: ' + score);
+ healthText.setText('Health: ' + player.health);
+ waveText.setText('Wave: ' + waveNumber);
+ // Check win condition (survive for a very long time)
+ if (score >= 10000) {
+ LK.showYouWin();
+ }
+};
\ No newline at end of file
Human. In-Game asset. 2d. High contrast. No shadows
Zombie. In-Game asset. 2d. High contrast. No shadows
Health. In-Game asset. 2d. High contrast. No shadows
Weapon. In-Game asset. 2d. High contrast. No shadows
Exit. In-Game asset. 2d. High contrast. No shadows
Maze exit. In-Game asset. 2d. High contrast. No shadows
Bullet. In-Game asset. 2d. High contrast. No shadows
Player Health. In-Game asset. 2d. High contrast. No shadows