0% found this document useful (0 votes)
3 views44 pages

Zombie Survival Game Interface Design

Uploaded by

arif Fahmi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views44 pages

Zombie Survival Game Interface Design

Uploaded by

arif Fahmi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

<!

DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-
scale=1.0, user-scalable=no"/>
<title>Zombie Survival: Enhanced</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: #000;
overflow: hidden;
font-family: 'Arial', sans-serif;
color: #fff;
touch-action: manipulation;
height: 100vh;
width: 100vw;
}
canvas {
display: block;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
.ui-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 10;
}
.hud {
position: absolute;
top: 20px;
left: 20px;
font-size: 16px;
text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
pointer-events: none;
}
#activeBuffs {
position: absolute;
top: 20px;
right: 20px;
text-align: right;
}
.buff-icon {
display: inline-block;
padding: 4px 8px;
background: rgba(0,0,0,0.6);
border-radius: 5px;
margin-bottom: 5px;
font-size: 12px;
}
.controls {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 150px;
display: flex;
justify-content: space-between;
align-items: flex-end;
padding: 10px;
z-index: 20;
pointer-events: auto;
}
.left-controls {
display: flex;
flex-direction: column;
align-items: center;
}
.control-btn {
width: 50px;
height: 50px;
border-radius: 50%;
border: 2px solid;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
font-size: 12px;
user-select: none;
cursor: pointer;
transition: all 0.1s;
position: relative;
overflow: hidden;
}
.joystick {
background: rgba(255,255,255,0.1);
border-color: #0f0;
color: #0f0;
}
.shoot-btn {
background: rgba(255,0,0,0.2);
border-color: #f00;
color: #f00;
}
.ability-btn {
background: rgba(0,100,255,0.2);
border-color: #06f;
color: #06f;
}
.reload-btn {
background: rgba(200,100,0,0.2);
border-color: #c60;
color: #c60;
}
.[Link]-cooldown {
background: rgba(100,100,100,0.4);
border-color: #666;
color: #666;
}
.cooldown-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.7);
transform: translateY(100%);
transition: transform 0.1s linear;
}
.[Link] {
transform: scale(0.9);
box-shadow: inset 0 0 15px rgba(255,255,255,0.3);
}
.menu {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgba(0,0,0,0.95);
border: 3px solid #f00;
border-radius: 15px;
padding: 30px;
text-align: center;
z-index: 100;
min-width: 300px;
}
.menu h2 {
margin-bottom: 20px;
color: #f00;
}
.menu-btn {
padding: 15px 30px;
margin: 10px;
background: #f00;
color: white;
border: none;
border-radius: 8px;
font-size: 16px;
cursor: pointer;
transition: all 0.2s;
}
.menu-btn:hover {
background: #ff3333;
transform: translateY(-2px);
}
.hidden {
display: none;
}
@keyframes fadeUp {
from { opacity: 1; transform: translateY(0); }
to { opacity: 0; transform: translateY(-30px); }
}
@keyframes bossWarning {
0%, 100% { color: #f00; }
50% { color: #ff0; }
}
.damage-text, .pickup-text, .boss-text {
position: absolute;
font-weight: bold;
font-size: 18px;
animation: fadeUp 1s forwards;
pointer-events: none;
z-index: 50;
}
.damage-text { color: #ff0; }
.pickup-text { color: #0f0; }
.boss-text {
color: #f00;
font-size: 24px;
animation: bossWarning 0.5s infinite;
}
.boss-health-bar {
position: absolute;
top: 60px;
left: 50%;
transform: translateX(-50%);
width: 300px;
height: 20px;
background: rgba(0,0,0,0.7);
border: 2px solid #f00;
border-radius: 10px;
overflow: hidden;
z-index: 30;
}
.boss-health-fill {
height: 100%;
background: linear-gradient(90deg, #f00, #ff0);
transition: width 0.3s;
}
.boss-name {
position: absolute;
top: 35px;
left: 50%;
transform: translateX(-50%);
color: #f00;
font-size: 18px;
font-weight: bold;
text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
z-index: 30;
}
</style>
</head>
<body>
<canvas id="gameCanvas"></canvas>
<div class="ui-overlay">
<div class="hud">
<div id="waveInfo">Wave: 1</div>
<div id="scoreInfo">Score: 0</div>
<div id="healthInfo">Health: 100/100</div>
<div id="weaponInfo">Weapon: Pistol</div>
<div id="petInfo">Pet: None</div>
<div id="ammoInfo">Ammo: ∞</div>
<div id="abilityInfo">Ability: None</div>
</div>
<div id="activeBuffs"></div>
<div id="bossHealthContainer" class="hidden">
<div class="boss-name" id="bossName">Boss Name</div>
<div class="boss-health-bar">
<div class="boss-health-fill" id="bossHealthFill"></div>
</div>
</div>
</div>
<div class="controls">
<div class="left-controls">
<div id="joystick" class="control-btn joystick"></div>
</div>
<div class="right-controls">
<div id="shootBtn" class="control-btn shoot-btn">SHOOT</div>
<div id="abilityBtn" class="control-btn ability-btn">ABILITY</div>
<div id="reloadBtn" class="control-btn reload-btn">RELOAD</div>
</div>
</div>

<div id="mainMenu" class="menu">


<h2>ZOMBIE SURVIVAL: ENHANCED</h2>
<button id="startBtn" class="menu-btn">START GAME</button>
<button id="howToPlayBtn" class="menu-btn">HOW TO PLAY</button>
</div>

<div id="howToPlayMenu" class="menu hidden">


<h2>HOW TO PLAY</h2>
<p>Use the left joystick to move</p>
<p>Tap anywhere to aim and shoot</p>
<p>Collect weapons, pets, and buffs</p>
<p>Survive as many waves as possible!</p>
<button id="backBtn" class="menu-btn">BACK</button>
</div>

<div id="pauseMenu" class="menu hidden">


<h2>GAME PAUSED</h2>
<button id="resumeBtn" class="menu-btn">RESUME</button>
<button id="restartBtn" class="menu-btn">RESTART</button>
<button id="menuBtn" class="menu-btn">MAIN MENU</button>
</div>

<div id="gameOverMenu" class="menu hidden">


<h2>GAME OVER</h2>
<p id="finalScore">Score: 0</p>
<button id="playAgainBtn" class="menu-btn">PLAY AGAIN</button>
<button id="menuFromGameOverBtn" class="menu-btn">MAIN MENU</button>
</div>

<script>
// ONLY THE FIXES YOU REQUESTED - NO OTHER CHANGES
// 1. FIXED AUTO-AIM (doesn't follow joystick)
// 2. FIXED PET VISUALIZATION (now visible)
// 3. FIXED WAVE SYSTEM (proper progression)

// CONFIG object
const CONFIG = {
player: {
size: 15,
maxHealth: 100,
speed: 200
},
bullet: {
size: 5,
speed: 500
}
};

// Weapons
const WEAPONS = [
{
name: "Pistol",
damage: 10,
fireRate: 250,
spread: 0.05,
pellets: 1,
range: 500,
ammo: -1, // -1 means infinite
color: '#fff'
},
{
name: "Shotgun",
damage: 5,
fireRate: 800,
spread: 0.5,
pellets: 6,
range: 300,
ammo: 8,
color: '#fff'
},
{
name: "Machine Gun",
damage: 6,
fireRate: 100,
spread: 0.1,
pellets: 1,
range: 400,
ammo: 30,
color: '#fff'
},
{
name: "Sniper",
damage: 50,
fireRate: 1200,
spread: 0.01,
pellets: 1,
range: 800,
ammo: 5,
color: '#fff'
},
{
name: "Flamethrower",
damage: 3,
fireRate: 50,
spread: 0.3,
pellets: 1,
range: 150,
ammo: 100,
color: '#ff8c00'
}
];

// Pets
const PETS = [
{
name: "Unicorn",
color: "#fff",
ability: "Heals player over time",
rarity: "epic",
healAmount: 2,
healRate: 1500
},
{
name: "Griffin",
color: "#DAA520",
ability: "Aerial scout and attacker",
rarity: "legendary",
attackDamage: 4,
attackRate: 600,
flying: true,
fireDamage: 3,
fireRange: 100
},
{
name: "Cerberus",
color: "#4B0000",
ability: "Three-headed hellhound",
rarity: "legendary",
attackDamage: 5,
attackRate: 500,
multiAttack: 3
},
{
name: "Fairy",
color: "#FF69B4",
ability: "Buffs all abilities",
rarity: "legendary",
damageBoost: 1.5,
speedBoost: 1.2,
healAmount: 1
}
];

// Boss types
const BOSS_TYPES = [
{
name: "Shadow King",
size: 60,
speed: 60,
health: 100,
maxHealth: 100,
damage: 5,
points: 500,
color: '#2F2F2F',
abilities: ['teleport', 'shadowClones'],
lastAbility: 0,
abilityRate: 2000,
phase: true
},
{
name: "Apocalypse Beast",
size: 100,
speed: 70,
health: 200,
maxHealth: 200,
damage: 10,
points: 1000,
color: '#800000',
abilities: ['meteors', 'shockwave', 'regenerate'],
lastAbility: 0,
abilityRate: 3500,
armor: 5
}
];

// Enhanced zombie types


const ZOMBIE_TYPES = [
{
name: 'Walker',
size: 18,
speed: 100,
health: 1,
damage: 1,
points: 10,
color: '#709030'
},
{
name: 'Runner',
size: 15,
speed: 140,
health: 1,
damage: 1,
points: 12,
color: '#ff66cc'
},
{
name: 'Jumper',
size: 20,
speed: 120,
health: 2,
damage: 2,
points: 20,
color: '#8A2BE2',
jumpCooldown: 3000
},
{
name: 'Spitter',
size: 18,
speed: 90,
health: 2,
damage: 1,
points: 15,
color: '#FFA500',
spitCooldown: 2000,
range: 200
},
{
name: 'Tank',
size: 25,
speed: 80,
health: 5,
damage: 3,
points: 30,
color: '#4682B4'
},
{
name: 'Toxic',
size: 22,
speed: 100,
health: 3,
damage: 2,
points: 25,
color: '#ADFF2F',
poisonRate: 2000
}
];

// Utility Functions
class Utils {
static distance(a, b) {
return [Link](a.x - b.x, a.y - b.y);
}

static angle(from, to) {


return Math.atan2(to.y - from.y, to.x - from.x);
}

static clamp(value, min, max) {


return [Link]([Link](value, min), max);
}

static random(min, max) {


return [Link]() * (max - min) + min;
}
}

// Object Pool Class


class ObjectPool {
constructor(createFunc, resetFunc) {
[Link] = createFunc;
[Link] = resetFunc;
[Link] = [];
[Link] = [];
}

get() {
let obj;
if ([Link] > 0) {
obj = [Link]();
} else {
obj = [Link]();
}
[Link](obj);
[Link] = true;
return obj;
}
release(obj) {
const index = [Link](obj);
if (index !== -1) {
[Link](index, 1);
[Link](obj);
[Link](obj);
}
}

releaseAll() {
for (const obj of [Link]) {
[Link](obj);
[Link](obj);
}
[Link] = 0;
}
}

// Enhanced Game Entities


class Entity {
constructor(x, y, size, color) {
this.x = x;
this.y = y;
[Link] = size;
[Link] = color;
[Link] = 0;
[Link] = 0;
[Link] = true;
[Link] = 0;
}

update(deltaTime) {
this.x += [Link] * deltaTime;
this.y += [Link] * deltaTime;
}

render(ctx) {
[Link]();
[Link](this.x, this.y);
[Link]([Link]);
[Link] = [Link];
[Link]();
[Link](0, 0, [Link], 0, [Link] * 2);
[Link]();
[Link]();
}

collidesWith(other) {
return [Link](this, other) < [Link] + [Link];
}
}

class Bullet extends Entity {


constructor() {
super(0, 0, [Link], '#ff0');
[Link] = 1;
[Link] = 3000;
[Link] = 0;
[Link] = 'normal';
[Link] = false;
[Link] = false;
[Link] = [];
}

reset() {
this.x = 0;
this.y = 0;
[Link] = 0;
[Link] = 0;
[Link] = true;
[Link] = 0;
[Link] = 'normal';
[Link] = false;
[Link] = false;
[Link] = [];
}

update(deltaTime) {
if ([Link] === 'tracer' || [Link] === 'laser' || [Link] ===
'plasma') {
[Link]({ x: this.x, y: this.y, time: [Link]() });
[Link] = [Link](t => [Link]() - [Link] < 200);
}
[Link](deltaTime);
[Link] += deltaTime * 1000;
if ([Link] > [Link] || this.x < -50 || this.x > [Link]
+ 50 ||
this.y < -50 || this.y > [Link] + 50) {
[Link] = false;
}
}

render(ctx) {
if ([Link] === 'acid') {
[Link] = '#32CD32';
[Link] = 8;
[Link] = '#32CD32';
} else {
[Link] = [Link];
}
[Link]();
[Link](this.x, this.y, [Link], 0, [Link] * 2);
[Link]();
[Link] = 0;
}
}

class Particle extends Entity {


constructor() {
super(0, 0, 2, '#fff');
[Link] = 1000;
[Link] = 0;
[Link] = 1;
}

reset() {
this.x = 0;
this.y = 0;
[Link] = 0;
[Link] = 0;
[Link] = true;
[Link] = 0;
[Link] = 1;
[Link] = 2;
}

update(deltaTime) {
[Link](deltaTime);
[Link] += deltaTime * 1000;
[Link] = 1 - ([Link] / [Link]);
if ([Link] > [Link]) {
[Link] = false;
}
}

render(ctx) {
[Link] = [Link];
[Link] = [Link];
[Link]();
[Link](this.x, this.y, [Link], 0, [Link] * 2);
[Link]();
[Link] = 1;
}
}

class Pickup extends Entity {


constructor(x, y, type, data) {
super(x, y, 16, [Link] || '#fff');
[Link] = type; // 'weapon', 'pet', 'buff', 'ability'
[Link] = data;
[Link] = 0;
[Link] = 20000;
[Link] = 0;
}

update(deltaTime) {
[Link] += deltaTime * 1000;
[Link] += deltaTime * 3;
[Link] = 16 + [Link]([Link]) * 4;
if ([Link] > [Link]) {
[Link] = false;
}
}

render(ctx) {
[Link]();
[Link] = 15;
[Link] = [Link];
[Link](ctx);
[Link] = '#000';
[Link] = 'bold 14px Arial';
[Link] = 'center';
let char = 'P';
if ([Link] === 'weapon') char = 'W';
if ([Link] === 'buff') char = 'B';
if ([Link] === 'ability') char = 'S';
[Link](char, this.x, this.y + 5);
[Link] = [Link];
[Link] = '12px Arial';
[Link]([Link], this.x, this.y + 30);
[Link]();
}
}

class Player extends Entity {


constructor(x, y) {
super(x, y, [Link], [Link]);
[Link] = [Link];
[Link] = [Link];
[Link] = [Link];
[Link] = [Link];
[Link] = 0;
[Link] = WEAPONS[0];
[Link] = []; // Changed from single pet to array of pets
[Link] = 0;
[Link] = 0;
[Link] = false;

[Link] = -1; // Infinite for starting weapon


[Link] = null;
[Link] = 0;
[Link] = [];
[Link] = false;
[Link] = 0;
[Link] = false;
[Link] = 0;
[Link] = [];
}

update(deltaTime, input) {
[Link](deltaTime);

let currentSpeed = [Link];


// Apply pet speed boosts
for (const pet of [Link]) {
if ([Link]) {
currentSpeed *= [Link];
}
}

[Link] = [Link] * currentSpeed;


[Link] = [Link] * currentSpeed;
[Link](deltaTime);

const canvas = [Link]('gameCanvas');


this.x = [Link](this.x, [Link], [Link] - [Link]);
this.y = [Link](this.y, [Link], [Link] - [Link]);

// Update all pets


for (const pet of [Link]) {
[Link](deltaTime, pet);
}

// Berserk effect
if ([Link]) {
[Link] -= deltaTime;
if ([Link] <= 0) {
[Link] = false;
[Link] = '#39ff14'; // Reset to normal color
}
}

// Healing Circle effect


if ([Link]) {
[Link] -= deltaTime;
// Spawn healing particles periodically
if ([Link]() - [Link] > 1000) {
[Link] = [Link]();

for (let i = 0; i < 3; i++) {


const particle = {
x: this.x + [Link](-20, 20),
y: this.y + [Link](-20, 20),
vx: 0,
vy: 0,
color: '#0f0',
lifetime: 800,
size: 3
};
[Link](particle);
}
}

// Heal player over time


if ([Link] < [Link]) {
[Link] = [Link]([Link], [Link] + 0.5);
}

// End healing circle when timer runs out


if ([Link] <= 0) {
[Link] = false;
}
}
}

updatePet(deltaTime, pet) {
if (![Link](pet)) return;
const now = [Link]();
const player = this;

// Different pet behaviors


switch ([Link]) {
case "Unicorn":
// Heal player over time
if (now - [Link] > [Link] && [Link] < [Link])
{
[Link] = [Link]([Link], [Link] + [Link]);
[Link] = now;
for (let i = 0; i < 3; i++) {
const particle = [Link]();
particle.x = this.x + [Link](-20, 20);
particle.y = this.y + [Link](-20, 20);
[Link] = 0;
[Link] = 0;
[Link] = '#ADFF2F';
[Link] = 5000;
[Link] = 8;
}
}
break;

case "Griffin":
// Move toward nearest zombie
const nearestZombie = [Link]((nearest, zombie) => {
const distance = [Link](pet, zombie);
return (!nearest || distance < [Link](pet, nearest)) ? zombie
: nearest;
}, null);

if (nearestZombie) {
const angle = [Link](pet, nearestZombie);
const dist = [Link](pet, nearestZombie);
[Link] = [Link](angle) * 100 * (dist > 150 ? 1 : dist / 150);
[Link] = [Link](angle) * 100 * (dist > 150 ? 1 : dist / 150);
} else {
// Follow player when no zombies
const angle = [Link](pet, this);
const dist = [Link](pet, this);
[Link] = [Link](angle) * 100 * (dist > 150 ? 1 : dist / 150);
[Link] = [Link](angle) * 100 * (dist > 150 ? 1 : dist / 150);
}
// Fire breath
if (now - [Link] > 2000) {
const nearbyZombies = [Link](z =>
[Link](pet, z) < ([Link] || 100));
if ([Link] > 0) {
for (const target of [Link](0, 3)) {
[Link] -= [Link];
[Link](target.x, target.y, [Link]);
}
for (let i = 0; i < 8; i++) {
const particle = [Link]();
particle.x = pet.x;
particle.y = pet.y;
const angle = [Link](pet, nearbyZombies[0]);
[Link] = [Link](angle) * 200;
[Link] = [Link](angle) * 200;
[Link] = '#ff8c00';
[Link] = 500;
[Link] = 3;
}
[Link] = now;
}
}
break;

case "Cerberus":
// Move toward nearest zombie
const nearestZombieCerberus = [Link]((nearest, zombie) =>
{
const distance = [Link](pet, zombie);
return (!nearest || distance < [Link](pet, nearest)) ? zombie
: nearest;
}, null);
if (nearestZombieCerberus && [Link](pet, nearestZombieCerberus)
< 100) {
// Move toward zombie
const angle = [Link](pet, nearestZombieCerberus);
const dist = [Link](pet, nearestZombieCerberus);
[Link] = [Link](angle) * 100 * (dist > 50 ? 1 : dist / 50);
[Link] = [Link](angle) * 100 * (dist > 50 ? 1 : dist / 50);
} else {
// Follow player when no zombies
const angle = [Link](pet, this);
const dist = [Link](pet, this);
[Link] = [Link](angle) * 100 * (dist > 100 ? 1 : dist / 100);
[Link] = [Link](angle) * 100 * (dist > 100 ? 1 : dist / 100);
}
// Multi-attack
if (now - [Link] > [Link]) {
const nearbyZombies = [Link](z =>
[Link](pet, z) < 60);
if ([Link] > 0) {
for (const target of [Link](0, [Link])) {
[Link] -= [Link];
[Link](target.x, target.y,
[Link]);
}
[Link] = now;
}
}
break;

case "Fairy":
// Move toward player
const angle = [Link](pet, this);
const dist = [Link](pet, this);
[Link] = [Link](angle) * 80 * (dist > 50 ? 1 : dist / 50);
[Link] = [Link](angle) * 80 * (dist > 50 ? 1 : dist / 50);
// Heal player
if (now - [Link] > ([Link] || 2000) && [Link] <
[Link]) {
[Link] = [Link]([Link], [Link] + [Link]);
[Link] = now;
for (let i = 0; i < 3; i++) {
const particle = [Link]();
particle.x = this.x + [Link](-20, 20);
particle.y = this.y + [Link](-20, 20);
[Link] = [Link](-30, 30);
[Link] = [Link](-30, 30);
[Link] = '#0f0';
[Link] = 800;
}
}
break;
}
}

applyBuffs(deltaTime) {
// Update buff durations
[Link] = [Link](buff => {
[Link] -= deltaTime;
return [Link] > 0;
});

// Apply buff effects


let speedMultiplier = 1;
for (const buff of [Link]) {
if ([Link]) speedMultiplier *= [Link];
if ([Link] && [Link]) [Link] *=
[Link];
}

[Link] = [Link] * speedMultiplier;


}

addBuff(buffData) {
[Link]({
name: [Link],
effect: [Link],
duration: [Link]
});
}

setWeapon(weaponData) {
[Link] = weaponData;
[Link] = [Link];
}

setAbility(abilityData) {
[Link] = abilityData;
[Link] = 0;
}

reload() {
if ([Link] !== -1) {
[Link] = [Link];
[Link](this.x, this.y, "RELOADED!");
}
}

canUseAbility() {
return [Link] && ([Link]() - [Link] >
[Link]);
}

useAbility() {
if (![Link]()) return;

[Link] = [Link]();

switch ([Link]) {
case "Black Hole":
const blackHole = {
x: [Link].x,
y: [Link].y,
radius: 100,
created: [Link](),
duration: 5000
};
[Link](blackHole);
// Visual effect
for (let i = 0; i < 15; i++) {
const particle = [Link]();
particle.x = blackHole.x + [Link](-50, 50);
particle.y = blackHole.y + [Link](-50, 50);
[Link] = 0;
[Link] = 0;
[Link] = '#00008B';
[Link] = 4000;
[Link] = [Link](3, 6);
}
break;

case "Chain Lightning":


// Find nearest zombies and chain lightning between them
if ([Link] > 0) {
// Start with player's position
let currentX = this.x;
let currentY = this.y;
let remainingJumps = 5;
let damage = 3;

// Create lightning effect from player


for (let i = 0; i < 3; i++) {
const particle = [Link]();
particle.x = currentX;
particle.y = currentY;
[Link] = 0;
[Link] = 0;
[Link] = '#00bfff';
[Link] = 300;
[Link] = 5;
}

// Chain between zombies


while (remainingJumps > 0 && [Link] > 0) {
const nearestZombie = [Link]((nearest, zombie) => {
const distance = [Link]({x: currentX, y: currentY},
zombie);
return (!nearest || distance < [Link]({x: currentX, y:
currentY}, nearest)) ? zombie : nearest;
}, null);

if (nearestZombie) {
// Create lightning effect
const angle = [Link]({x: currentX, y: currentY},
nearestZombie);
const distance = [Link]({x: currentX, y: currentY},
nearestZombie);

for (let i = 0; i < 5; i++) {


const offsetX = [Link](-5, 5);
const offsetY = [Link](-5, 5);
const particle = [Link]();
particle.x = currentX + offsetX;
particle.y = currentY + offsetY;
[Link] = [Link](angle) * distance;
[Link] = [Link](angle) * distance;
[Link] = '#00bfff';
[Link] = 200;
[Link] = 3;
}

// Damage zombie
[Link] -= damage;
[Link](nearestZombie.x, nearestZombie.y,
damage);

// Prepare for next jump


currentX = nearestZombie.x;
currentY = nearestZombie.y;
damage *= 0.7;
remainingJumps--;
} else {
break;
}
}
}
break;

case "Berserk":
[Link] = true;
[Link] = 10.0; // 10 seconds duration
[Link] = '#dc143c'; // Red color for berserk

// Visual effect - red aura


for (let i = 0; i < 15; i++) {
const particle = [Link]();
particle.x = this.x + [Link](-50, 50);
particle.y = this.y + [Link](-50, 50);
[Link] = 0;
[Link] = 0;
[Link] = '#dc143c';
[Link] = 3000;
[Link] = [Link](4, 8);
}
break;

case "Time Slow":


[Link](z => [Link] = true);
setTimeout(() => [Link](z => [Link] = false), 5000);
// Visual effect - purple aura
for (let i = 0; i < 15; i++) {
const particle = [Link]();
particle.x = [Link].x + [Link](-50, 50);
particle.y = [Link].y + [Link](-50, 50);
[Link] = 0;
[Link] = 0;
[Link] = '#8a2be2';
[Link] = 3000;
[Link] = [Link](4, 8);
}
break;

case "Orbital Strike":


[Link]([Link].x,
[Link].y, "INCOMING!");
setTimeout(() => [Link]([Link].x,
[Link].y, 150, 50), 2000);
break;

case "Healing Circle":


[Link] = true;
[Link] = 8.0; // 8 seconds duration
[Link] = 0;
[Link] = [];
// Visual effect - green circle
for (let i = 0; i < 20; i++) {
const particle = [Link]();
const angle = [Link]() * [Link] * 2;
const distance = 80 + [Link]() * 20;
particle.x = this.x + [Link](angle) * distance;
particle.y = this.y + [Link](angle) * distance;
[Link] = 0;
[Link] = 0;
[Link] = '#0f0';
[Link] = 3000;
[Link] = 3;
}
break;
}
}

shoot(targetX, targetY) {
const now = [Link]();
if (now - [Link] < [Link]) return null;

if ([Link] !== -1 && [Link] <= 0) {


[Link]();
return null;
}

[Link] = now;

if ([Link] !== -1) {


[Link]--;
}

const angle = [Link](this, { x: targetX, y: targetY });


const bullets = [];
const pellets = [Link];
let damage = [Link];

// Berserk effect increases damage


if ([Link]) {
damage *= 1.5;
}

// Apply buff effects


const damageBuff = [Link](b => [Link]);
if (damageBuff) damage *= [Link];

// Apply pet damage boosts


for (const pet of [Link]) {
if ([Link]) damage *= [Link];
}
for (let i = 0; i < pellets; i++) {
const spreadAngle = angle + ([Link]() - 0.5) * [Link];
[Link]({
x: this.x + [Link](angle) * 30,
y: this.y + [Link](angle) * 30,
vx: [Link](spreadAngle) * [Link],
vy: [Link](spreadAngle) * [Link],
damage: damage,
color: [Link] || '#fff',
size: 5,
type: [Link] === 'Flamethrower' ? 'acid' : 'normal'
});
}

return bullets;
}

takeDamage(amount) {
if ([Link]) {
amount = [Link](1, amount - [Link]);
}
[Link] -= amount;
return [Link] <= 0;
}

heal(amount) {
[Link] = [Link]([Link], [Link] + amount);
}

addPet(petData) {
const pet = {
x: this.x,
y: this.y,
size: 12,
color: [Link],
name: [Link],
active: true,
lastAttack: 0
};

// Add pet-specific properties


[Link](pet, petData);

[Link](pet);
[Link](this.x, this.y, `+ ${[Link]} PET!`);
}

render(ctx) {
[Link](ctx);

// Weapon direction indicator


if ([Link]) {
const angle = [Link](this, [Link]);
[Link] = '#fff';
[Link] = 2;
[Link]();
[Link](this.x, this.y);
[Link](
this.x + [Link](angle) * 30,
this.y + [Link](angle) * 30
);
[Link]();
}

// Health bar
const barWidth = [Link] * 2;
const barHeight = 5;
const barX = this.x - [Link];
const barY = this.y + [Link] + 5;

[Link] = '#000';
[Link](barX, barY, barWidth, barHeight);
const healthPercent = [Link] / [Link];
[Link] = healthPercent > 0.5 ? '#0f0' : '#f00';
[Link](barX, barY, barWidth * healthPercent, barHeight);

// Berserk effect glow


if ([Link]) {
[Link]();
[Link]();
[Link](this.x, this.y, [Link] * 1.5, 0, [Link] * 2);
const gradient = [Link](
this.x, this.y, [Link],
this.x, this.y, [Link] * 1.5
);
[Link](0, 'rgba(220, 20, 60, 0.1)');
[Link](1, 'rgba(220, 20, 60, 0)');
[Link] = gradient;
[Link]();
[Link]();
}
}
}

class Zombie extends Entity {


constructor(x, y, type) {
super(x, y, [Link], [Link]);
[Link] = type;
[Link] = [Link];
[Link] = [Link];
[Link] = [Link];
[Link] = [Link];
[Link] = [Link];
[Link] = [Link];
[Link] = 0;
[Link] = 0;
[Link] = 0;
[Link] = false;
[Link] = 0;
[Link] = [];
[Link] = false;
}

update(deltaTime, player) {
const now = [Link]();

// Apply slow effect


[Link] = [Link] * ([Link] ? 0.3 : 1);

// Special abilities
switch ([Link]) {
case 'Jumper':
if (now - [Link] > 3000 && [Link](this, player) < 150) {
const angle = [Link](this, player);
[Link] = [Link](angle) * 500;
[Link] = [Link](angle) * 500;
[Link] = now;
setTimeout(() => {
[Link] = 0;
[Link] = 0;
}, 300);
} else if ([Link] === 0) {
[Link](player);
}
break;

case 'Spitter':
if (now - [Link] > 2000 && [Link](this, player) <
[Link]) {
[Link](player);
[Link] = now;
} else {
[Link](player);
}
break;

case 'Toxic':
if (now - [Link] > 2000) {
[Link]({x: this.x, y: this.y, time: now});
[Link] = now;
}
[Link](player);
break;

default:
[Link](player);
}

[Link](deltaTime);
}

moveTowardPlayer(player) {
const angle = [Link](this, player);
[Link] = [Link](angle) * [Link];
[Link] = [Link](angle) * [Link];
}

spitAtPlayer(player) {
const angle = [Link](this, player);
const bullet = [Link]();
bullet.x = this.x;
bullet.y = this.y;
[Link] = [Link](angle) * 300;
[Link] = [Link](angle) * 300;
[Link] = 1;
}
screamAttack(player) {
if ([Link](this, player) < 150) {
for (let i = 0; i < 10; i++) {
const particle = [Link]();
particle.x = this.x;
particle.y = this.y;
const angle = [Link]() * [Link] * 2;
[Link] = [Link](angle) * 100;
[Link] = [Link](angle) * 100;
[Link] = '#FF1493';
[Link] = 600;
}
}
}

takeDamage(amount) {
if ([Link]) {
amount = [Link](1, amount - [Link]);
}
[Link] -= amount;
return [Link] <= 0;
}

onDeath() {
if ([Link] === 'Exploder') {
[Link](this.x, this.y, 80, 3);
}
if ([Link] === 'Toxic') {
for (let i = 0; i < 5; i++) {
const particle = [Link]();
particle.x = this.x + [Link](-20, 20);
particle.y = this.y + [Link](-20, 20);
[Link] = 0;
[Link] = 0;
[Link] = '#ADFF2F';
[Link] = 5000;
[Link] = 8;
}
}
}

render(ctx) {
[Link](ctx);

// Health bar
const barWidth = [Link] * 2;
const barHeight = 5;
const barX = this.x - [Link];
const barY = this.y - [Link] - 10;

[Link] = '#000';
[Link](barX, barY, barWidth, barHeight);
const healthPercent = [Link] / [Link];
[Link] = healthPercent > 0.5 ? '#0f0' : '#f00';
[Link](barX, barY, barWidth * healthPercent, barHeight);

// Special effects for different zombie types


if ([Link] === 'Toxic') {
for (const trail of [Link]) {
[Link] = 0.3;
[Link] = '#ADFF2F';
[Link]();
[Link](trail.x, trail.y, [Link], 0, [Link] * 2);
[Link]();
}

// Remove old trail points


const now = [Link]();
[Link] = [Link](trail => now - [Link] <
2000);
}
}
}

class Boss extends Entity {


constructor(x, y, bossData) {
super(x, y, [Link], [Link]);
[Link](this, bossData);
[Link] = [Link];
[Link] = 0;
[Link] = 0;
[Link] = [];
[Link] = [];
}

update(deltaTime, player) {
const now = [Link]();
const angle = [Link](this, player);
[Link] = [Link](angle) * [Link];
[Link] = [Link](angle) * [Link];
[Link](deltaTime);

// Boss abilities
if (now - [Link] > [Link]) {
[Link] = now;
const abilityIndex = [Link] % [Link];
const ability = [Link][abilityIndex];

switch (ability) {
case 'charge':
[Link](player);
break;
case 'slam':
[Link](player);
break;
case 'rage':
[Link]();
break;
case 'toxicCloud':
[Link]();
break;
case 'spawn':
[Link]();
break;
case 'teleport':
[Link](player);
break;
case 'shadowClones':
[Link]();
break;
case 'meteors':
[Link]();
break;
case 'shockwave':
[Link](player);
break;
case 'regenerate':
[Link]();
break;
}

[Link](this.x, this.y - [Link] - 20,


[Link]());
[Link]++;
}
}

summonZombies() {
for (let i = 0; i < 3; i++) {
const angle = [Link]() * [Link] * 2;
const distance = 100;
const x = this.x + [Link](angle) * distance;
const y = this.y + [Link](angle) * distance;

// Find a valid position away from player


let validPosition = false;
let attempts = 0;
while (!validPosition && attempts < 10) {
const angle = [Link]() * [Link] * 2;
const distance = 100 + [Link]() * 100;
const x = this.x + [Link](angle) * distance;
const y = this.y + [Link](angle) * distance;

if ([Link]({x, y}, [Link]) > 300) {


validPosition = true;
const type = ZOMBIE_TYPES[[Link]([Link]() *
ZOMBIE_TYPES.length)];
[Link](new Zombie(x, y, type));
}
attempts++;
}
}
}

teleportAttack(player) {
const now = [Link]();
const angle = [Link]() * [Link] * 2;
const distance = 100;
this.x = player.x + [Link](angle) * distance;
this.y = player.y + [Link](angle) * distance;

// Visual effect
for (let i = 0; i < 10; i++) {
const particle = [Link]();
particle.x = this.x;
particle.y = this.y;
[Link] = [Link](-100, 100);
[Link] = [Link](-100, 100);
[Link] = '#2F2F2F';
[Link] = 500;
}
}

createShadowClones() {
[Link] = [];
for (let i = 0; i < 3; i++) {
const angle = ([Link] * 2 * i) / 3;
const distance = 80;
[Link]({
x: this.x + [Link](angle) * distance,
y: this.y + [Link](angle) * distance,
time: [Link]()
});
}
}

summonMeteors() {
[Link] = [];
for (let i = 0; i < 5; i++) {
const angle = [Link]() * [Link] * 2;
const distance = 300 + [Link]() * 200;
const meteorX = this.x + [Link](angle) * distance;
const meteorY = this.y + [Link](angle) * distance;

[Link]({
x: meteorX,
y: meteorY,
targetX: this.x,
targetY: this.y,
time: [Link](),
vx: -[Link](angle) * 2,
vy: -[Link](angle) * 2
});
}
}

createShockwave(player) {
// Create a shockwave effect
for (let i = 0; i < 20; i++) {
const angle = [Link]() * [Link] * 2;
const speed = 150 + [Link]() * 100;

const particle = [Link]();


particle.x = this.x;
particle.y = this.y;
[Link] = [Link](angle) * speed;
[Link] = [Link](angle) * speed;
[Link] = '#f00';
[Link] = 800;
[Link] = 4;
}
}

regenerateHealth() {
const healAmount = [Link] * 0.1;
[Link] = [Link]([Link], [Link] + healAmount);
}

takeDamage(damage) {
if ([Link]) {
damage = [Link](1, damage - [Link]);
}
[Link] -= damage;
return [Link] <= 0;
}

render(ctx) {
[Link](ctx);

// Health bar
const barWidth = [Link] * 2;
const barHeight = 8;
const barX = this.x - [Link];
const barY = this.y - [Link] - 15;

[Link] = '#000';
[Link](barX, barY, barWidth, barHeight);
const healthPercent = [Link] / [Link];
[Link] = healthPercent > 0.5 ? '#0f0' : healthPercent > 0.25 ?
'#ff0' : '#f00';
[Link](barX, barY, barWidth * healthPercent, barHeight);

// Boss name
[Link] = '#fff';
[Link] = '16px Arial';
[Link] = 'center';
[Link]([Link], this.x, this.y + [Link] + 20);

// Shadow clones
if ([Link]) {
for (const clone of [Link]) {
const age = [Link]() - [Link];
if (age < 2000) {
const alpha = 1 - (age / 2000);
[Link] = alpha * 0.5;
[Link] = '#2F2F2F';
[Link]();
[Link](clone.x, clone.y, [Link], 0, [Link] * 2);
[Link]();
[Link] = 1.0;
}
}
}

// Meteors
if ([Link]) {
for (const meteor of [Link]) {
const age = [Link]() - [Link];
if (age < 1000) {
[Link] = '#f80';
[Link]();
[Link](meteor.x, meteor.y, 15, 0, [Link] * 2);
[Link]();
}
}
}
}
}

// Input Manager
class InputManager {
constructor(canvas) {
[Link] = canvas;
[Link] = 0;
[Link] = 0;
[Link] = false;
[Link] = false;
[Link] = false;
[Link] = { x: [Link] / 2, y: [Link] / 2 };
[Link]();
}

setupControls() {
const joystick = [Link]('joystick');
const shootBtn = [Link]('shootBtn');
const abilityBtn = [Link]('abilityBtn');
const reloadBtn = [Link]('reloadBtn');

[Link]('touchmove', e => [Link](),


{ passive: false });

let joystickActive = false;


[Link]('touchstart', (e) => {
[Link]();
joystickActive = true;
[Link]('active');
[Link](e, joystick);
});

[Link]('touchmove', (e) => {


[Link]();
if (joystickActive) [Link](e, joystick);
});

[Link]('touchend', (e) => {


[Link]();
joystickActive = false;
[Link]('active');
[Link] = 'none';
[Link] = 0;
[Link] = 0;
});

[Link]('touchstart', (e) => {


[Link]();
[Link] = true;
[Link]('active');
});

[Link]('touchend', (e) => {


[Link]();
[Link] = false;
[Link]('active');
});

[Link]('touchstart', (e) => {


[Link]();
[Link] = true;
[Link]('active');
});

[Link]('touchend', (e) => {


[Link]();
[Link] = false;
[Link]('active');
});

[Link]('touchstart', (e) => {


[Link]();
[Link] = true;
[Link]('active');
});

[Link]('touchend', (e) => {


[Link]();
[Link] = false;
[Link]('active');
});

[Link]('touchstart', (e) => {


[Link]();
if ([Link] === [Link]) {
const touch = [Link][0];
[Link].x = [Link];
[Link].y = [Link];
}
});

[Link]('touchmove', (e) => {


[Link]();
if ([Link] === [Link]) {
const touch = [Link][0];
[Link].x = [Link];
[Link].y = [Link];
}
});
}

updateJoystick(e, joystick) {
const rect = [Link]();
const centerX = [Link] + [Link] / 2;
const centerY = [Link] + [Link] / 2;
const touch = [Link][0];
const deltaX = [Link] - centerX;
const deltaY = [Link] - centerY;
const distance = [Link](30, [Link](deltaX, deltaY));
const angle = Math.atan2(deltaY, deltaX);

[Link] = [Link](angle) * (distance / 30);


[Link] = [Link](angle) * (distance / 30);
[Link] = `translate(${deltaX * 0.8}px, ${deltaY *
0.8}px)`;
}
}

// Game Renderer
class GameRenderer {
constructor(canvas, ctx) {
[Link] = canvas;
[Link] = ctx;
[Link] = [Link]('canvas');
[Link] = [Link]('2d');
[Link] = false;
}

resize() {
[Link] = [Link];
[Link] = [Link];
if (![Link]) {
[Link]();
[Link] = true;
}
}

renderBackground() {
[Link] = [Link];
[Link] = [Link];
const ctx = [Link];

// Ground
[Link] = '#0a0a0a';
[Link](0, 0, [Link], [Link]);

// Buildings
[Link] = '#1a1a1a';
[Link](0, [Link] * 0.8, [Link],
[Link] * 0.2);

// City skyline
[Link] = '#222';
for (let i = 0; i < 15; i++) {
const x = i * ([Link] / 15);
const height = [Link](50, 200);
const width = [Link](40, 100);
[Link](x, [Link] - height, width, height);
}

// Windows
[Link] = '#333';
for (let i = 0; i < 50; i++) {
[Link](
[Link](0, [Link]),
[Link](0, [Link]),
2, 2
);
}
}

clear() {
[Link](0, 0, [Link], [Link]);
[Link]([Link], 0, 0);
}

showDamageText(x, y, damage) {
const element = [Link]('div');
[Link] = 'damage-text';
[Link] = `-${[Link](damage)}`;
[Link] = x + 'px';
[Link] = y + 'px';
[Link](element);

setTimeout(() => {
if ([Link](element)) {
[Link](element);
}
}, 1000);
}

showPickupText(x, y, text) {
const element = [Link]('div');
[Link] = 'pickup-text';
[Link] = text;
[Link] = x + 'px';
[Link] = y + 'px';
[Link](element);

setTimeout(() => {
if ([Link](element)) {
[Link](element);
}
}, 1500);
}

showBossText(x, y, text) {
const element = [Link]('div');
[Link] = 'boss-text';
[Link] = text;
[Link] = x + 'px';
[Link] = y + 'px';
[Link](element);

setTimeout(() => {
if ([Link](element)) {
[Link](element);
}
}, 2000);
}

showNotification(text) {
const element = [Link]('div');
[Link] = 'notification';
[Link] = text;
[Link](element);

setTimeout(() => {
if ([Link](element)) {
[Link](element);
}
}, 2000);
}
}

// Enhanced Game Manager


class GameManager {
constructor() {
[Link] = [Link]('gameCanvas');
[Link] = [Link]('2d');
[Link] = new GameRenderer([Link], [Link]);
[Link] = new InputManager([Link]);
[Link] = this;
[Link] = 'menu';

[Link] = 1;
[Link] = 0;
[Link] = 0;
[Link] = 0;
[Link] = 0;
[Link] = 0;
[Link] = null;
[Link] = null;
[Link] = [];
[Link] = [];
[Link] = [];
[Link] = new ObjectPool(() => new Bullet(), (b) => [Link]());
[Link] = new ObjectPool(() => new EnemyBullet(), (b) =>
[Link]());
[Link] = new ObjectPool(() => new Particle(), (p) => [Link]());

[Link]();
[Link]();
[Link]('resize', () => [Link]());
}

setupEventListeners() {
[Link]('startBtn').addEventListener('click', () => {
[Link]();
});

[Link]('howToPlayBtn').addEventListener('click', () => {
[Link]('mainMenu').[Link]('hidden');
[Link]('howToPlayMenu').[Link]('hidden');
});

[Link]('backBtn').addEventListener('click', () => {
[Link]('howToPlayMenu').[Link]('hidden');
[Link]('mainMenu').[Link]('hidden');
});

[Link]('resumeBtn').addEventListener('click', () => {
[Link]();
});

[Link]('restartBtn').addEventListener('click', () => {
[Link]();
});

[Link]('menuBtn').addEventListener('click', () => {
[Link]();
[Link]('mainMenu').[Link]('hidden');
});

[Link]('playAgainBtn').addEventListener('click', () => {
[Link]();
});

[Link]('menuFromGameOverBtn').addEventListener('click', ()
=> {
[Link]();
[Link]('mainMenu').[Link]('hidden');
});

// Pause on visibility change


[Link]('visibilitychange', () => {
if ([Link] && [Link] === 'playing') {
[Link]();
}
});
}

startGame() {
[Link] = 1;
[Link] = 0;
[Link] = 0;
[Link] = 0;
[Link] = 0;
[Link] = 0;
[Link] = null;
[Link] = new Player([Link] / 2, [Link] / 2);
[Link] = [];
[Link] = [];
[Link] = [];
[Link]();
[Link]();
[Link]();
[Link]();
[Link]('bossHealthContainer').[Link]('hidden');
[Link] = [Link]();
[Link]();
}

pauseGame() {
if ([Link] !== 'playing') return;
[Link] = 'paused';
[Link]();
[Link]('pauseMenu').[Link]('hidden');
}

resumeGame() {
[Link] = 'playing';
[Link]();
[Link] = [Link]();
[Link]();
}

gameOver() {
[Link] = 'gameOver';
[Link]();
[Link]('finalScore').textContent = `Score: ${[Link]}`;
[Link]('gameOverMenu').[Link]('hidden');
}

hideAllMenus() {
[Link]('mainMenu').[Link]('hidden');
[Link]('howToPlayMenu').[Link]('hidden');
[Link]('pauseMenu').[Link]('hidden');
[Link]('gameOverMenu').[Link]('hidden');
}

spawnZombies(deltaTime) {
const waveMultiplier = [Link](2.0, 1 + ([Link] - 1) * 0.1);
const zombiesToSpawn = [Link](10 + [Link] * 2, 30) * waveMultiplier;

if ([Link] < zombiesToSpawn) {


const spawnRadius = [Link](500, 200 + [Link] * 20);
const angle = [Link]() * [Link] * 2;
const distance = 500 + [Link]() * 200;
const x = [Link].x + [Link](angle) * distance;
const y = [Link].y + [Link](angle) * distance;

// Find a valid position away from player


let validPosition = false;
let attempts = 0;
while (!validPosition && attempts < 10) {
const angle = [Link]() * [Link] * 2;
const distance = 400 + [Link]() * 200;
const x = [Link].x + [Link](angle) * distance;
const y = [Link].y + [Link](angle) * distance;

if ([Link]({x, y}, [Link]) > 300) {


validPosition = true;
const zombieType = ZOMBIE_TYPES[[Link]([Link]() *
ZOMBIE_TYPES.length)];
[Link](new Zombie(x, y, zombieType));
}
attempts++;
}
}
}

spawnBoss() {
if ([Link]) return;

const bossData = BOSS_TYPES[[Link] % BOSS_TYPES.length];


let x, y;

// Find a position away from player


do {
const angle = [Link]() * [Link] * 2;
const distance = 500 + [Link]() * 200;
x = [Link].x + [Link](angle) * distance;
y = [Link].y + [Link](angle) * distance;
} while ([Link]({ x, y }, [Link]) < 300);

[Link] = new Boss(x, y, bossData);


[Link]([Link] / 2, 200, `${[Link]}
APPEARS!`);
[Link]('bossName').textContent = [Link];
[Link]('bossHealthContainer').[Link]('hidden');
}

updateHUD() {
[Link]('waveInfo').textContent = `Wave: ${[Link]}`;
[Link]('scoreInfo').textContent = `Score: ${[Link]}`;
[Link]('healthInfo').textContent = `Health: $
{[Link]([Link])}/${[Link]}`;
[Link]('weaponInfo').textContent = `Weapon: $
{[Link]}`;
[Link]('petInfo').textContent = `Pet: $
{[Link] > 0 ? [Link][0].name : 'None'}`;
[Link]('ammoInfo').textContent = `Ammo: $
{[Link] === -1 ? '∞' : [Link]}`;
[Link]('abilityInfo').textContent = `Ability: $
{[Link] ? [Link] : 'None'}`;

// Update active buffs display


const buffsContainer = [Link]('activeBuffs');
[Link] = '';
for (const buff of [Link]) {
const el = [Link]('div');
[Link] = 'buff-icon';
[Link] = [Link];
[Link] = [Link];
[Link] = `${[Link]} (${([Link] / 1000).toFixed(1)}s)`;
[Link](el);
}
}

gameLoop() {
if ([Link] !== 'playing') return;

const now = [Link]();


const deltaTime = (now - [Link]) / 1000;
[Link] = now;

// Cap deltaTime to prevent massive jumps


const maxDeltaTime = 0.1;
const cappedDeltaTime = [Link](deltaTime, maxDeltaTime);

// Update player
[Link](cappedDeltaTime, [Link]);

// Ability usage
if ([Link] && [Link]()) {
[Link]();
}

// Reload handling
if ([Link]) {
[Link]();
}

// Auto-aim assist system - FIXED


let targetX = [Link].x;
let targetY = [Link].y;

if ([Link]) {
const nearestEnemy = [Link]((nearest, zombie) => {
const distance = [Link]([Link], zombie);
return (!nearest || distance < [Link]([Link], nearest)) ?
zombie : nearest;
}, null);

const distanceToEnemy = nearestEnemy ? [Link]([Link],


nearestEnemy) : Infinity;

// CORRECTED AUTO-AIM LOGIC - DOESN'T FOLLOW JOYSTICK


if (nearestEnemy && distanceToEnemy < 500) {
const angleToTouch = [Link]([Link], { x: targetX, y:
targetY });
const angleToEnemy = [Link]([Link], nearestEnemy);

// Proper angle difference calculation (smallest possible angle between


vectors)
let angleDiff = [Link](angleToTouch - angleToEnemy);
angleDiff = [Link](angleDiff, 2 * [Link] - angleDiff);

// Adjusted thresholds for better auto-aim behavior


let aimAssistThreshold;
if (distanceToEnemy < 150) {
aimAssistThreshold = 1.0; // Full assist up close
} else if (distanceToEnemy < 300) {
aimAssistThreshold = 0.7; // Strong assist at medium range
} else {
aimAssistThreshold = 0.4; // Moderate assist at long range
}

if (angleDiff < aimAssistThreshold) {


targetX = nearestEnemy.x;
targetY = nearestEnemy.y;

// Visual feedback: green particles near enemy when assist activates


for (let i = 0; i < 2; i++) {
const particle = [Link]();
particle.x = nearestEnemy.x + [Link](-10, 10);
particle.y = nearestEnemy.y + [Link](-10, 10);
[Link] = 0;
[Link] = 0;
[Link] = '#0f0';
[Link] = 300;
[Link] = 3;
}
}
}

// Shoot at the (possibly adjusted) target


const bulletDataArray = [Link](targetX, targetY);
if (bulletDataArray) {
for (const bulletData of bulletDataArray) {
const bullet = [Link]();
[Link](bullet, bulletData);
if ([Link] === 'piercing') [Link] = true;
if ([Link] === 'rocket') [Link] = true;
}
}
}
// Update bullets
for (const bullet of [Link]) {
if (![Link]) continue;
[Link](cappedDeltaTime);
if (![Link]) { [Link](bullet); continue; }

let hitTarget = false;


// Check zombie collisions
for (let i = [Link] - 1; i >= 0; i--) {
const zombie = [Link][i];
if ([Link](zombie)) {
const killed = [Link]([Link]);
if (killed) {
// Chance to drop pickup
if ([Link]() < 0.3) {
const pickupType = [Link]();
if (pickupType < 0.4) {
// Weapon pickup
const weapon = WEAPONS[[Link]([Link]() *
[Link])];
[Link](new Pickup(zombie.x, zombie.y, 'weapon',
weapon));
} else if (pickupType < 0.7) {
// Pet pickup
const pet = PETS[[Link]([Link]() * [Link])];
[Link](new Pickup(zombie.x, zombie.y, 'pet', pet));
} else if (pickupType < 0.9) {
// Buff pickup
const buff = BUFFS[[Link]([Link]() * [Link])];
[Link](new Pickup(zombie.x, zombie.y, 'buff',
buff));
} else {
// Ability pickup
const ability = ABILITIES[[Link]([Link]() *
[Link])];
[Link](new Pickup(zombie.x, zombie.y, 'ability',
ability));
}
}
[Link](i, 1);
}
hitTarget = true;
}
}

// Check boss collision


if ([Link] && [Link]([Link])) {
if ([Link]([Link])) {
[Link] = null;

[Link]('bossHealthContainer').[Link]('hidden');
} else {
const healthPercent = [Link] /
[Link];
[Link]('bossHealthFill').[Link] =
(healthPercent * 100) + '%';
}
[Link]([Link].x, [Link].y,
[Link]);
if ([Link]) [Link](bullet.x, bullet.y, 60,
[Link]);
hitTarget = true;
}

if (hitTarget && ![Link]) {


[Link](bullet);
}
}

// Update enemy bullets


for (const bullet of [Link]) {
if (![Link]) continue;
[Link](cappedDeltaTime);
if (![Link]) { [Link](bullet); continue; }

if ([Link]([Link])) {
if ([Link]([Link])) {
[Link]();
return;
}
[Link](bullet);
}
}

// Update zombies
for (let i = [Link] - 1; i >= 0; i--) {
const zombie = [Link][i];
[Link](cappedDeltaTime, [Link]);

if ([Link] <= 0) {
// Chance to drop pickup
if ([Link]() < 0.3) {
const pickupType = [Link]();
if (pickupType < 0.4) {
// Weapon pickup
const weapon = WEAPONS[[Link]([Link]() * [Link])];
[Link](new Pickup(zombie.x, zombie.y, 'weapon',
weapon));
} else if (pickupType < 0.7) {
// Pet pickup
const pet = PETS[[Link]([Link]() * [Link])];
[Link](new Pickup(zombie.x, zombie.y, 'pet', pet));
} else if (pickupType < 0.9) {
// Buff pickup
const buff = BUFFS[[Link]([Link]() * [Link])];
[Link](new Pickup(zombie.x, zombie.y, 'buff', buff));
} else {
// Ability pickup
const ability = ABILITIES[[Link]([Link]() *
[Link])];
[Link](new Pickup(zombie.x, zombie.y, 'ability',
ability));
}
}
[Link](i, 1);
}
// Check collision with player
if ([Link]([Link])) {
if ([Link]([Link])) {
[Link]();
return;
}
}
}

// Update boss
if ([Link]) {
[Link](cappedDeltaTime, [Link]);

// Check boss collision with player


if ([Link]([Link])) {
if ([Link]([Link])) {
[Link]();
return;
}
}
}

// Update pickups
for (let i = [Link] - 1; i >= 0; i--) {
const pickup = [Link][i];
[Link](cappedDeltaTime);
if (![Link]) { [Link](i, 1); continue; }

if ([Link]([Link])) {
if ([Link] === 'weapon') [Link]([Link]);
else if ([Link] === 'pet') [Link]([Link]);
else if ([Link] === 'buff') [Link]([Link]);
else if ([Link] === 'ability')
[Link]([Link]);

if ([Link] !== 'buff') {


[Link]([Link].x, [Link].y, `$
{[Link]}!`);
}
[Link](i, 1);
}
}

// Update particles
for (const particle of [Link]) {
if (![Link]) continue;
[Link](cappedDeltaTime);
if (![Link]) [Link](particle);
}

// FIX 3: Wave System - Fixed progression logic


if ([Link] === 0 && ![Link]) {
// Start wave clear timer
if ([Link] === 0) {
[Link] = [Link]();
}
// Wave cleared after 3 seconds with no enemies
else if ([Link]() - [Link] > 3000) {
[Link]++;
[Link] = 0;

// Check if it's a boss wave (every 5 waves)


if ([Link] % 5 === 0) {
[Link]();
} else {
// Start spawning zombies for the new wave immediately
[Link] = [Link]() - 1000;
}

// Show wave number


[Link](`Wave ${[Link]}`);
}
}
// Reset wave clear timer if enemies still exist
else {
[Link] = 0;
}

// Spawn zombies for regular waves (non-boss)


if (![Link] && [Link] < [Link] &&
[Link]() - [Link] > 1000) {
[Link](cappedDeltaTime);
[Link] = [Link]();
}

// Update HUD
[Link]();

// Render
[Link]();
if ([Link] === 'playing') {
for (const pickup of [Link]) [Link]([Link]);
for (const particle of [Link]) if ([Link])
[Link]([Link]);
for (const bullet of [Link]) if ([Link])
[Link]([Link]);
for (const bullet of [Link]) if ([Link])
[Link]([Link]);
for (const zombie of [Link]) [Link]([Link]);

// FIX 2: Pet Visualization - Added proper rendering


if ([Link] && [Link]) {
for (const pet of [Link]) {
if (![Link]) continue;

// Draw pet as a colored circle


[Link]();
[Link] = [Link];
[Link]();
[Link](pet.x, pet.y, [Link] || 12, 0, [Link] * 2);
[Link]();

// Add a small outline for better visibility


[Link] = '#fff';
[Link] = 1;
[Link]();
[Link]();
}
}

if ([Link]) [Link]([Link]);

// Render game entities (like black holes)


for (const entity of [Link]) {
if ([Link]() - [Link] < [Link]) {
[Link] = 0.5;
[Link] = '#00008B';
[Link]();
[Link](entity.x, entity.y, [Link], 0, [Link] * 2);
[Link]();
[Link] = 1.0;

// Apply black hole effect to zombies


for (const zombie of [Link]) {
const dist = [Link]({x: entity.x, y: entity.y}, zombie);
if (dist < 200) {
const angle = [Link]({x: entity.x, y: entity.y}, zombie);
const pullForce = (200 - dist) / 200 * 0.5;
[Link] -= [Link](angle) * pullForce;
[Link] -= [Link](angle) * pullForce;
[Link] = true;
}
}
}
}

[Link]([Link]);
}

// Continue game loop


requestAnimationFrame(() => [Link]());
}

createExplosion(x, y, radius, damage) {


// Create explosion particles
for (let i = 0; i < 20; i++) {
const particle = [Link]();
particle.x = x;
particle.y = y;
const angle = [Link]() * [Link] * 2;
const speed = [Link](150, 400);
[Link] = [Link](angle) * speed;
[Link] = [Link](angle) * speed;
[Link] = i % 3 === 0 ? '#f80' : i % 3 === 1 ? '#ff0' : '#f40';
[Link] = [Link](600, 1200);
[Link] = [Link](4, 8);
}

// Damage entities in radius


if ([Link]({x, y}, [Link]) < radius) {
[Link]([Link](1, damage * 0.3));
}

for (const zombie of [Link]) {


if ([Link]({x, y}, zombie) < radius) {
[Link] -= damage;
}
}

if ([Link] && [Link]({x, y}, [Link]) < radius)


{
[Link](damage);
}
}
}

// Buffs
const BUFFS = [
{
name: "Speed Boost",
color: "#00bfff",
effect: { speed: 1.3 },
duration: 5000
},
{
name: "Damage Boost",
color: "#ff4500",
effect: { damage: 1.5 },
duration: 5000
},
{
name: "Regeneration",
color: "#32cd32",
effect: { heal: 1 },
duration: 8000
},
{
name: "Armor",
color: "#4682b4",
effect: { armor: 0.5 },
duration: 6000
}
];

// Abilities
const ABILITIES = [
{
name: "Black Hole",
rarity: "legendary",
cooldown: 45000,
color: "#4b0082"
},
{
name: "Chain Lightning",
rarity: "legendary",
cooldown: 12000,
color: "#00bfff"
},
{
name: "Berserk",
rarity: "epic",
cooldown: 20000,
color: "#dc143c"
},
{
name: "Time Slow",
rarity: "epic",
cooldown: 30000,
color: "#8a2be2"
},
{
name: "Orbital Strike",
rarity: "legendary",
cooldown: 60000,
color: "#ff8c00"
},
{
name: "Healing Circle",
rarity: "epic",
cooldown: 25000,
color: "#00ff00"
}
];

// Initialize game
[Link]('DOMContentLoaded', () => {
const game = new GameManager();
[Link]('mainMenu').[Link]('hidden');
});
</script>
</body>
</html>

You might also like