User prompt
slightly up and not adjacent side by side but not adjacent
User prompt
Click the button to make the sale and update work and not to be where the enemies pass and be at the bottom
User prompt
Click on the buttons and put it in the middle so that the enemies don't come their way
User prompt
Go up a little and write it in the middle so it's clear
User prompt
add sales price
User prompt
When i click on purchased items again . İ can sell them or level them up
User prompt
Add a sale, write the price in writing
User prompt
Make the path a little shorter so people don't get bored while playing
User prompt
Extend the path a little more, add in complicated places
User prompt
The machine should not pass where the enemy is passing, it should not interfere with that place, only next to it.
User prompt
Put the machine where I want
User prompt
I can place it on any side of the map I want, delete the placement blocks so they are not visible
User prompt
Let the machine hit fast and hit its target
User prompt
Show me the range of each machine and the range it will hit
User prompt
It's not a bomb counter and reduce the bomb counter a little bit because it's not visible And you'll move the BOMB💣 one up
User prompt
increase the hitting size and speed of the machines and because one machine can't kill them all and fix the bomb text move it up and take less out
User prompt
Design a highly detailed and compact tower defense game user interface. The scene is viewed from a top-down perspective. In the center, a path runs through a ruined, post-apocalyptic city, with incoming mutated enemy creatures (not classic zombies). Display a "Level 1" tag at the top of the screen, increasing each round. At the bottom of the screen, create a large, clearly visible turret selection panel. Each turret (Laser Gun, Missile Tower, Fire Blaster, Electric Field) is shown with large font names and prices: Laser Gun – $50 Missile Tower – $80 Fire Blaster – $100 Electric Field – $70 Only one turret can be selected at a time – show this by highlighting the selected machine with a glow or border. Machines have visible range indicators (circle radius around them), which expand slightly with each upgrade. Display the player's money at the top-left corner ("Money: $230") in large font, and show a limited-use bomb icon (e.g. "Bombs: 2") in the top-right. In early levels, enemies are weak and slow. From Level 5 and beyond, enemies get small visual effects like glowing red eyes, faster speed trails, or light armor glows – but keep effects minimal to avoid clutter. Introduce variety: fast runners, armored ones, and small swarm types. UI should be sleek and futuristic, but game-like. Use glowing elements, clean fonts, and compact layout. Add subtle animations (like turrets rotating or firing) and health bars above enemies. The atmosphere is dark, gritty, and intense. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Design a highly detailed and compact tower defense game user interface. The scene is viewed from a top-down perspective. In the center, a path runs through a ruined, post-apocalyptic city, with incoming mutated enemy creatures (not classic zombies). Display a "Level 1" tag at the top of the screen, increasing each round. At the bottom of the screen, create a large, clearly visible turret selection panel. Each turret (Laser Gun, Missile Tower, Fire Blaster, Electric Field) is shown with large font names and prices: Laser Gun – $50 Missile Tower – $80 Fire Blaster – $100 Electric Field – $70 Only one turret can be selected at a time – show this by highlighting the selected machine with a glow or border. Machines have visible range indicators (circle radius around them), which expand slightly with each upgrade. Display the player's money at the top-left corner ("Money: $230") in large font, and show a limited-use bomb icon (e.g. "Bombs: 2") in the top-right. In early levels, enemies are weak and slow. From Level 5 and beyond, enemies get small visual effects like glowing red eyes, faster speed trails, or light armor glows – but keep effects minimal to avoid clutter. Introduce variety: fast runners, armored ones, and small swarm types. UI should be sleek and futuristic, but game-like. Use glowing elements, clean fonts, and compact layout. Add subtle animations (like turrets rotating or firing) and health bars above enemies. The atmosphere is dark, gritty, and intense. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
A highly detailed, compact tower defense game UI layout. The top corner shows a glowing money counter (e.g. "$230"). Below it, a small menu of futuristic defense machines: laser turret ($50), missile launcher ($80), fire drone ($100), electric trap ($70) – each with its cost shown clearly. Waves of enemies (mutated creatures instead of classic zombies) move through a dark, ruined city path. Each wave increases in difficulty slightly (level 1, level 2, etc., shown at the top). Players can deploy powerful bombs (shown as a limited-use icon, like "3 bombs left") to destroy enemies. The whole map is compact but filled with small details – glowing effects, health bars, machine animations. Viewed from a top-down game angle. UI design is sleek, minimal, futuristic. Game atmosphere: dark, intense, post-apocalyptic.
Code edit (1 edits merged)
Please save this source code
User prompt
Mutant Breach: Tower Defense
Initial prompt
A dark and post-apocalyptic tower defense game scene where waves of glowing, mutated zombies attack through broken city streets. High-tech futuristic defense machines (turrets, laser drones, flamethrower bots, missile towers) are strategically placed, firing at the zombies. Each level of the map looks different: Level 1 is a destroyed highway, Level 2 is an abandoned mall, Level 3 is a nuclear wasteland. The machines glow with blue and red lights, zombies are grotesque and glowing green. Epic, detailed, top-down view, in video game concept art style.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var BuildSpot = Container.expand(function () {
var self = Container.call(this);
var spotGraphics = self.attachAsset('buildSpot', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.5
});
self.isOccupied = false;
self.turret = null;
self.down = function (x, y, obj) {
if (self.isOccupied) return;
if (currency < 50) return;
// Build turret
var turret = new Turret();
turret.x = self.x;
turret.y = self.y;
self.turret = turret;
self.isOccupied = true;
currency -= 50;
updateCurrencyDisplay();
turrets.push(turret);
game.addChild(turret);
// Hide build spot
spotGraphics.alpha = 0.1;
// Flash green when built
LK.effects.flashObject(turret, 0x44ff44, 500);
};
return self;
});
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 8;
self.damage = 25;
self.targetX = 0;
self.targetY = 0;
self.target = null;
self.isDestroyed = false;
self.update = function () {
if (self.isDestroyed) return;
// Move towards target
var dx = self.targetX - self.x;
var dy = self.targetY - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 10) {
self.x += dx / distance * self.speed;
self.y += dy / distance * self.speed;
} else {
// Hit target
if (self.target && !self.target.isDead) {
self.target.takeDamage(self.damage);
// Create explosion effect
var explosion = game.addChild(LK.getAsset('explosion', {
anchorX: 0.5,
anchorY: 0.5,
x: self.x,
y: self.y
}));
tween(explosion, {
alpha: 0,
scaleX: 2,
scaleY: 2
}, {
duration: 300,
onFinish: function onFinish() {
explosion.destroy();
}
});
LK.getSound('explosion').play();
}
self.isDestroyed = true;
}
};
return self;
});
var Turret = Container.expand(function () {
var self = Container.call(this);
var turretGraphics = self.attachAsset('turret', {
anchorX: 0.5,
anchorY: 0.5
});
self.damage = 25;
self.range = 200;
self.fireRate = 60; // frames between shots
self.lastShot = 0;
self.target = null;
self.cost = 50;
self.findTarget = function () {
var closestZombie = null;
var closestDistance = self.range;
for (var i = 0; i < zombies.length; i++) {
var zombie = zombies[i];
if (zombie.isDead) continue;
var dx = zombie.x - self.x;
var dy = zombie.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < closestDistance) {
closestDistance = distance;
closestZombie = zombie;
}
}
return closestZombie;
};
self.shoot = function (target) {
var bullet = new Bullet();
bullet.x = self.x;
bullet.y = self.y;
bullet.targetX = target.x;
bullet.targetY = target.y;
bullet.damage = self.damage;
bullet.target = target;
bullets.push(bullet);
game.addChild(bullet);
LK.getSound('shoot').play();
// Flash blue when shooting
LK.effects.flashObject(self, 0x4444ff, 200);
};
self.update = function () {
self.lastShot++;
if (self.lastShot >= self.fireRate) {
var target = self.findTarget();
if (target) {
self.shoot(target);
self.lastShot = 0;
}
}
};
return self;
});
var Zombie = Container.expand(function () {
var self = Container.call(this);
var zombieGraphics = self.attachAsset('zombie', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 100;
self.maxHealth = 100;
self.speed = 1;
self.reward = 10;
self.pathIndex = 0;
self.targetX = 0;
self.targetY = 0;
self.isDead = false;
self.takeDamage = function (damage) {
self.health -= damage;
if (self.health <= 0) {
self.isDead = true;
currency += self.reward;
updateCurrencyDisplay();
LK.getSound('zombieHit').play();
// Flash red when dying
LK.effects.flashObject(self, 0xff0000, 300);
}
};
self.update = function () {
if (self.isDead) return;
// Move towards target
var dx = self.targetX - self.x;
var dy = self.targetY - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 5) {
self.x += dx / distance * self.speed;
self.y += dy / distance * self.speed;
} else {
// Reached current target, move to next path point
self.pathIndex++;
if (self.pathIndex >= gamePath.length) {
// Reached end - damage base
lives--;
updateLivesDisplay();
if (lives <= 0) {
LK.showGameOver();
}
self.isDead = true;
} else {
self.targetX = gamePath[self.pathIndex].x;
self.targetY = gamePath[self.pathIndex].y;
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a1a
});
/****
* Game Code
****/
var zombies = [];
var turrets = [];
var bullets = [];
var buildSpots = [];
var gamePath = [];
var currency = 100;
var lives = 10;
var wave = 1;
var zombiesSpawned = 0;
var zombiesToSpawn = 5;
var spawnTimer = 0;
var spawnRate = 120; // frames between spawns
var waveActive = false;
var waveCompleted = false;
// Create path points for zombies to follow
gamePath = [{
x: 0,
y: 1366
}, {
x: 500,
y: 1366
}, {
x: 500,
y: 800
}, {
x: 1200,
y: 800
}, {
x: 1200,
y: 1366
}, {
x: 1700,
y: 1366
}, {
x: 1700,
y: 600
}, {
x: 2048,
y: 600
}];
// Create visual path
for (var i = 0; i < gamePath.length - 1; i++) {
var start = gamePath[i];
var end = gamePath[i + 1];
var steps = Math.floor(Math.sqrt((end.x - start.x) * (end.x - start.x) + (end.y - start.y) * (end.y - start.y)) / 120);
for (var j = 0; j <= steps; j++) {
var t = j / steps;
var pathX = start.x + (end.x - start.x) * t;
var pathY = start.y + (end.y - start.y) * t;
var pathTile = game.addChild(LK.getAsset('path', {
anchorX: 0.5,
anchorY: 0.5,
x: pathX,
y: pathY,
alpha: 0.3
}));
}
}
// Create build spots
var buildPositions = [{
x: 300,
y: 1100
}, {
x: 700,
y: 1100
}, {
x: 300,
y: 1600
}, {
x: 700,
y: 1600
}, {
x: 800,
y: 600
}, {
x: 1000,
y: 600
}, {
x: 800,
y: 1000
}, {
x: 1000,
y: 1000
}, {
x: 1400,
y: 1100
}, {
x: 1500,
y: 1100
}, {
x: 1400,
y: 1600
}, {
x: 1500,
y: 1600
}, {
x: 1400,
y: 400
}, {
x: 1500,
y: 400
}, {
x: 1900,
y: 400
}, {
x: 1900,
y: 800
}];
for (var i = 0; i < buildPositions.length; i++) {
var buildSpot = new BuildSpot();
buildSpot.x = buildPositions[i].x;
buildSpot.y = buildPositions[i].y;
buildSpots.push(buildSpot);
game.addChild(buildSpot);
}
// UI Elements
var currencyTxt = new Text2('Currency: ' + currency, {
size: 60,
fill: 0xFFFF00
});
currencyTxt.anchor.set(0, 0);
LK.gui.topRight.addChild(currencyTxt);
var livesTxt = new Text2('Lives: ' + lives, {
size: 60,
fill: 0xFF4444
});
livesTxt.anchor.set(1, 0);
LK.gui.topLeft.addChild(livesTxt);
var waveTxt = new Text2('Wave: ' + wave, {
size: 60,
fill: 0x44FF44
});
waveTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(waveTxt);
var startWaveBtn = new Text2('START WAVE', {
size: 80,
fill: 0xFFFFFF
});
startWaveBtn.anchor.set(0.5, 0.5);
startWaveBtn.x = 1024;
startWaveBtn.y = 2600;
game.addChild(startWaveBtn);
function updateCurrencyDisplay() {
currencyTxt.setText('Currency: ' + currency);
}
function updateLivesDisplay() {
livesTxt.setText('Lives: ' + lives);
}
function updateWaveDisplay() {
waveTxt.setText('Wave: ' + wave);
}
function startWave() {
if (waveActive) return;
waveActive = true;
waveCompleted = false;
zombiesSpawned = 0;
zombiesToSpawn = 5 + wave * 2;
spawnTimer = 0;
startWaveBtn.alpha = 0.3;
// Increase zombie health each wave
Zombie.prototype.baseHealth = 100 + wave * 25;
}
function spawnZombie() {
if (zombiesSpawned >= zombiesToSpawn) return;
var zombie = new Zombie();
zombie.x = gamePath[0].x;
zombie.y = gamePath[0].y;
zombie.targetX = gamePath[1].x;
zombie.targetY = gamePath[1].y;
zombie.health = 100 + wave * 25;
zombie.maxHealth = zombie.health;
zombie.speed = 1 + wave * 0.2;
zombie.reward = 10 + wave * 5;
zombies.push(zombie);
game.addChild(zombie);
zombiesSpawned++;
}
function checkWaveComplete() {
if (!waveActive) return;
var aliveZombies = 0;
for (var i = 0; i < zombies.length; i++) {
if (!zombies[i].isDead) {
aliveZombies++;
}
}
if (zombiesSpawned >= zombiesToSpawn && aliveZombies === 0) {
waveActive = false;
waveCompleted = true;
wave++;
updateWaveDisplay();
currency += 50; // Wave completion bonus
updateCurrencyDisplay();
startWaveBtn.alpha = 1;
// Flash screen green for wave completion
LK.effects.flashScreen(0x44ff44, 1000);
// Check win condition
if (wave > 10) {
LK.showYouWin();
}
}
}
// Start wave button interaction
startWaveBtn.down = function (x, y, obj) {
startWave();
};
game.update = function () {
// Spawn zombies
if (waveActive && zombiesSpawned < zombiesToSpawn) {
spawnTimer++;
if (spawnTimer >= spawnRate) {
spawnZombie();
spawnTimer = 0;
}
}
// Clean up dead zombies
for (var i = zombies.length - 1; i >= 0; i--) {
if (zombies[i].isDead) {
zombies[i].destroy();
zombies.splice(i, 1);
}
}
// Clean up destroyed bullets
for (var i = bullets.length - 1; i >= 0; i--) {
if (bullets[i].isDestroyed) {
bullets[i].destroy();
bullets.splice(i, 1);
}
}
checkWaveComplete();
}; ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,434 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var BuildSpot = Container.expand(function () {
+ var self = Container.call(this);
+ var spotGraphics = self.attachAsset('buildSpot', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ alpha: 0.5
+ });
+ self.isOccupied = false;
+ self.turret = null;
+ self.down = function (x, y, obj) {
+ if (self.isOccupied) return;
+ if (currency < 50) return;
+ // Build turret
+ var turret = new Turret();
+ turret.x = self.x;
+ turret.y = self.y;
+ self.turret = turret;
+ self.isOccupied = true;
+ currency -= 50;
+ updateCurrencyDisplay();
+ turrets.push(turret);
+ game.addChild(turret);
+ // Hide build spot
+ spotGraphics.alpha = 0.1;
+ // Flash green when built
+ LK.effects.flashObject(turret, 0x44ff44, 500);
+ };
+ return self;
+});
+var Bullet = Container.expand(function () {
+ var self = Container.call(this);
+ var bulletGraphics = self.attachAsset('bullet', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 8;
+ self.damage = 25;
+ self.targetX = 0;
+ self.targetY = 0;
+ self.target = null;
+ self.isDestroyed = false;
+ self.update = function () {
+ if (self.isDestroyed) return;
+ // Move towards target
+ var dx = self.targetX - self.x;
+ var dy = self.targetY - self.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance > 10) {
+ self.x += dx / distance * self.speed;
+ self.y += dy / distance * self.speed;
+ } else {
+ // Hit target
+ if (self.target && !self.target.isDead) {
+ self.target.takeDamage(self.damage);
+ // Create explosion effect
+ var explosion = game.addChild(LK.getAsset('explosion', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: self.x,
+ y: self.y
+ }));
+ tween(explosion, {
+ alpha: 0,
+ scaleX: 2,
+ scaleY: 2
+ }, {
+ duration: 300,
+ onFinish: function onFinish() {
+ explosion.destroy();
+ }
+ });
+ LK.getSound('explosion').play();
+ }
+ self.isDestroyed = true;
+ }
+ };
+ return self;
+});
+var Turret = Container.expand(function () {
+ var self = Container.call(this);
+ var turretGraphics = self.attachAsset('turret', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.damage = 25;
+ self.range = 200;
+ self.fireRate = 60; // frames between shots
+ self.lastShot = 0;
+ self.target = null;
+ self.cost = 50;
+ self.findTarget = function () {
+ var closestZombie = null;
+ var closestDistance = self.range;
+ for (var i = 0; i < zombies.length; i++) {
+ var zombie = zombies[i];
+ if (zombie.isDead) continue;
+ var dx = zombie.x - self.x;
+ var dy = zombie.y - self.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance < closestDistance) {
+ closestDistance = distance;
+ closestZombie = zombie;
+ }
+ }
+ return closestZombie;
+ };
+ self.shoot = function (target) {
+ var bullet = new Bullet();
+ bullet.x = self.x;
+ bullet.y = self.y;
+ bullet.targetX = target.x;
+ bullet.targetY = target.y;
+ bullet.damage = self.damage;
+ bullet.target = target;
+ bullets.push(bullet);
+ game.addChild(bullet);
+ LK.getSound('shoot').play();
+ // Flash blue when shooting
+ LK.effects.flashObject(self, 0x4444ff, 200);
+ };
+ self.update = function () {
+ self.lastShot++;
+ if (self.lastShot >= self.fireRate) {
+ var target = self.findTarget();
+ if (target) {
+ self.shoot(target);
+ self.lastShot = 0;
+ }
+ }
+ };
+ return self;
+});
+var Zombie = Container.expand(function () {
+ var self = Container.call(this);
+ var zombieGraphics = self.attachAsset('zombie', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.health = 100;
+ self.maxHealth = 100;
+ self.speed = 1;
+ self.reward = 10;
+ self.pathIndex = 0;
+ self.targetX = 0;
+ self.targetY = 0;
+ self.isDead = false;
+ self.takeDamage = function (damage) {
+ self.health -= damage;
+ if (self.health <= 0) {
+ self.isDead = true;
+ currency += self.reward;
+ updateCurrencyDisplay();
+ LK.getSound('zombieHit').play();
+ // Flash red when dying
+ LK.effects.flashObject(self, 0xff0000, 300);
+ }
+ };
+ self.update = function () {
+ if (self.isDead) return;
+ // Move towards target
+ var dx = self.targetX - self.x;
+ var dy = self.targetY - self.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance > 5) {
+ self.x += dx / distance * self.speed;
+ self.y += dy / distance * self.speed;
+ } else {
+ // Reached current target, move to next path point
+ self.pathIndex++;
+ if (self.pathIndex >= gamePath.length) {
+ // Reached end - damage base
+ lives--;
+ updateLivesDisplay();
+ if (lives <= 0) {
+ LK.showGameOver();
+ }
+ self.isDead = true;
+ } else {
+ self.targetX = gamePath[self.pathIndex].x;
+ self.targetY = gamePath[self.pathIndex].y;
+ }
+ }
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x1a1a1a
+});
+
+/****
+* Game Code
+****/
+var zombies = [];
+var turrets = [];
+var bullets = [];
+var buildSpots = [];
+var gamePath = [];
+var currency = 100;
+var lives = 10;
+var wave = 1;
+var zombiesSpawned = 0;
+var zombiesToSpawn = 5;
+var spawnTimer = 0;
+var spawnRate = 120; // frames between spawns
+var waveActive = false;
+var waveCompleted = false;
+// Create path points for zombies to follow
+gamePath = [{
+ x: 0,
+ y: 1366
+}, {
+ x: 500,
+ y: 1366
+}, {
+ x: 500,
+ y: 800
+}, {
+ x: 1200,
+ y: 800
+}, {
+ x: 1200,
+ y: 1366
+}, {
+ x: 1700,
+ y: 1366
+}, {
+ x: 1700,
+ y: 600
+}, {
+ x: 2048,
+ y: 600
+}];
+// Create visual path
+for (var i = 0; i < gamePath.length - 1; i++) {
+ var start = gamePath[i];
+ var end = gamePath[i + 1];
+ var steps = Math.floor(Math.sqrt((end.x - start.x) * (end.x - start.x) + (end.y - start.y) * (end.y - start.y)) / 120);
+ for (var j = 0; j <= steps; j++) {
+ var t = j / steps;
+ var pathX = start.x + (end.x - start.x) * t;
+ var pathY = start.y + (end.y - start.y) * t;
+ var pathTile = game.addChild(LK.getAsset('path', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: pathX,
+ y: pathY,
+ alpha: 0.3
+ }));
+ }
+}
+// Create build spots
+var buildPositions = [{
+ x: 300,
+ y: 1100
+}, {
+ x: 700,
+ y: 1100
+}, {
+ x: 300,
+ y: 1600
+}, {
+ x: 700,
+ y: 1600
+}, {
+ x: 800,
+ y: 600
+}, {
+ x: 1000,
+ y: 600
+}, {
+ x: 800,
+ y: 1000
+}, {
+ x: 1000,
+ y: 1000
+}, {
+ x: 1400,
+ y: 1100
+}, {
+ x: 1500,
+ y: 1100
+}, {
+ x: 1400,
+ y: 1600
+}, {
+ x: 1500,
+ y: 1600
+}, {
+ x: 1400,
+ y: 400
+}, {
+ x: 1500,
+ y: 400
+}, {
+ x: 1900,
+ y: 400
+}, {
+ x: 1900,
+ y: 800
+}];
+for (var i = 0; i < buildPositions.length; i++) {
+ var buildSpot = new BuildSpot();
+ buildSpot.x = buildPositions[i].x;
+ buildSpot.y = buildPositions[i].y;
+ buildSpots.push(buildSpot);
+ game.addChild(buildSpot);
+}
+// UI Elements
+var currencyTxt = new Text2('Currency: ' + currency, {
+ size: 60,
+ fill: 0xFFFF00
+});
+currencyTxt.anchor.set(0, 0);
+LK.gui.topRight.addChild(currencyTxt);
+var livesTxt = new Text2('Lives: ' + lives, {
+ size: 60,
+ fill: 0xFF4444
+});
+livesTxt.anchor.set(1, 0);
+LK.gui.topLeft.addChild(livesTxt);
+var waveTxt = new Text2('Wave: ' + wave, {
+ size: 60,
+ fill: 0x44FF44
+});
+waveTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(waveTxt);
+var startWaveBtn = new Text2('START WAVE', {
+ size: 80,
+ fill: 0xFFFFFF
+});
+startWaveBtn.anchor.set(0.5, 0.5);
+startWaveBtn.x = 1024;
+startWaveBtn.y = 2600;
+game.addChild(startWaveBtn);
+function updateCurrencyDisplay() {
+ currencyTxt.setText('Currency: ' + currency);
+}
+function updateLivesDisplay() {
+ livesTxt.setText('Lives: ' + lives);
+}
+function updateWaveDisplay() {
+ waveTxt.setText('Wave: ' + wave);
+}
+function startWave() {
+ if (waveActive) return;
+ waveActive = true;
+ waveCompleted = false;
+ zombiesSpawned = 0;
+ zombiesToSpawn = 5 + wave * 2;
+ spawnTimer = 0;
+ startWaveBtn.alpha = 0.3;
+ // Increase zombie health each wave
+ Zombie.prototype.baseHealth = 100 + wave * 25;
+}
+function spawnZombie() {
+ if (zombiesSpawned >= zombiesToSpawn) return;
+ var zombie = new Zombie();
+ zombie.x = gamePath[0].x;
+ zombie.y = gamePath[0].y;
+ zombie.targetX = gamePath[1].x;
+ zombie.targetY = gamePath[1].y;
+ zombie.health = 100 + wave * 25;
+ zombie.maxHealth = zombie.health;
+ zombie.speed = 1 + wave * 0.2;
+ zombie.reward = 10 + wave * 5;
+ zombies.push(zombie);
+ game.addChild(zombie);
+ zombiesSpawned++;
+}
+function checkWaveComplete() {
+ if (!waveActive) return;
+ var aliveZombies = 0;
+ for (var i = 0; i < zombies.length; i++) {
+ if (!zombies[i].isDead) {
+ aliveZombies++;
+ }
+ }
+ if (zombiesSpawned >= zombiesToSpawn && aliveZombies === 0) {
+ waveActive = false;
+ waveCompleted = true;
+ wave++;
+ updateWaveDisplay();
+ currency += 50; // Wave completion bonus
+ updateCurrencyDisplay();
+ startWaveBtn.alpha = 1;
+ // Flash screen green for wave completion
+ LK.effects.flashScreen(0x44ff44, 1000);
+ // Check win condition
+ if (wave > 10) {
+ LK.showYouWin();
+ }
+ }
+}
+// Start wave button interaction
+startWaveBtn.down = function (x, y, obj) {
+ startWave();
+};
+game.update = function () {
+ // Spawn zombies
+ if (waveActive && zombiesSpawned < zombiesToSpawn) {
+ spawnTimer++;
+ if (spawnTimer >= spawnRate) {
+ spawnZombie();
+ spawnTimer = 0;
+ }
+ }
+ // Clean up dead zombies
+ for (var i = zombies.length - 1; i >= 0; i--) {
+ if (zombies[i].isDead) {
+ zombies[i].destroy();
+ zombies.splice(i, 1);
+ }
+ }
+ // Clean up destroyed bullets
+ for (var i = bullets.length - 1; i >= 0; i--) {
+ if (bullets[i].isDestroyed) {
+ bullets[i].destroy();
+ bullets.splice(i, 1);
+ }
+ }
+ checkWaveComplete();
+};
\ No newline at end of file