User prompt
not working
User prompt
not working
User prompt
The flow of the game should be like this: First the user clicks on play game and then the game starts.
User prompt
Let's add main menu in which there are 2 options, first is Play Game and second is High Score. Whenuser click on the Play Game option, the game starts and when user click on the High Score button, the tab shows the player's high score.
User prompt
delay for next wave is 4 second pls
User prompt
wave WAVE ' + this.currentWave + '\n' + 'āļø Zombie Invasion āļø\n' + 'š§ Weak: ' + zombieComposition.weakCount + '\n' + 'ā” Fast: ' + zombieComposition.fastCount + '\n' + 'šŖ Tough: ' + zombieComposition.toughCount, This message will remain visible until the wave is finished
User prompt
when wave completed then wave message is shown pls
User prompt
Please fix the bug: 'zombie.spawn is not a function' in or related to this line: 'zombie.spawn();' Line Number: 289
User prompt
Please fix the bug: 'powerUp.spawn is not a function' in or related to this line: 'powerUp.spawn();' Line Number: 307
User prompt
Please fix the bug: 'zombie.spawn is not a function' in or related to this line: 'zombie.spawn();' Line Number: 289
Code edit (1 edits merged)
Please save this source code
User prompt
after the txt message disappear then zombie spawn
Code edit (1 edits merged)
Please save this source code
User prompt
wave txt is shown for 2 seconds
Code edit (1 edits merged)
Please save this source code
User prompt
decrease chance of power up to 0.6
Code edit (1 edits merged)
Please save this source code
User prompt
send to slightly right
User prompt
send to slightly right
User prompt
send to slightly left
Code edit (1 edits merged)
Please save this source code
User prompt
")" Now instead of this symbol it should be written how many zombies have died so far.
Code edit (1 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
User prompt
send to slightly up
===================================================================
--- original.js
+++ change.js
@@ -111,8 +111,12 @@
self.x += dx * self.speed;
self.y += dy * self.speed;
}
};
+ self.spawn = function () {
+ game.addChild(self);
+ zombies.push(self);
+ };
return self;
});
/****
* Specific Zombie Types
@@ -194,13 +198,26 @@
type: ToughZombie,
baseCount: 1
}],
startNextWave: function startNextWave() {
+ var _this = this;
this.currentWave++;
this.zombiesKilled = 0;
+ // Show the "Wave Complete" message before starting the next wave
+ if (this.currentWave > 1) {
+ this.showWaveCompleteMessage(function () {
+ _this.initiateWave(); // Start the next wave
+ });
+ } else {
+ this.initiateWave();
+ }
+ },
+ initiateWave: function initiateWave() {
+ // Calculate zombie composition for the wave
var zombieComposition = this.calculateZombieComposition();
this.zombiesRemaining = zombieComposition.total;
- var waveText = new Text2('WAVE ' + this.currentWave + '\n' + 'āļø Zombie Invasion āļø\n' + 'š§ Weak: ' + zombieComposition.weakCount + '\n' + 'ā” Fast: ' + zombieComposition.fastCount + '\n' + 'šŖ Tough: ' + zombieComposition.toughCount, {
+ // Display the wave start message
+ var waveText = new Text2('WAVE ' + this.currentWave + '\nāļø Zombie Invasion āļø\nš§ Weak: ' + zombieComposition.weakCount + '\nā” Fast: ' + zombieComposition.fastCount + '\nšŖ Tough: ' + zombieComposition.toughCount, {
size: 70,
fill: 0xFF0000,
align: 'center'
});
@@ -211,59 +228,76 @@
LK.getSound('waveStart').play();
LK.setTimeout(function () {
game.removeChild(waveText);
}, 3000);
+ // Spawn zombies for this wave
this.spawnWaveZombies(zombieComposition);
+ // Spawn a power-up if applicable
if (Math.random() < this.powerUpSpawnChance) {
this.spawnPowerUp();
}
},
+ showWaveCompleteMessage: function showWaveCompleteMessage(callback) {
+ // Display the wave complete message
+ var completeText = new Text2('WAVE COMPLETE!\nPrepare for the next wave...', {
+ size: 80,
+ fill: 0x00FF00,
+ align: 'center'
+ });
+ completeText.anchor.set(0.5, 0.5);
+ completeText.x = 2048 / 2;
+ completeText.y = 2732 / 2;
+ game.addChild(completeText);
+ LK.setTimeout(function () {
+ game.removeChild(completeText);
+ // Proceed to the next step (callback)
+ if (typeof callback === 'function') {
+ callback();
+ }
+ }, 3000); // Show message for 3 seconds
+ },
calculateZombieComposition: function calculateZombieComposition() {
- var weakBase = this.zombieTypes[0].baseCount + Math.floor(this.currentWave / 2);
- var fastBase = this.zombieTypes[1].baseCount + Math.floor(this.currentWave / 3);
- var toughBase = this.zombieTypes[2].baseCount + Math.floor(this.currentWave / 4);
- var composition = {
- weakCount: weakBase,
- fastCount: fastBase,
- toughCount: toughBase
+ // Determine how many zombies of each type to spawn
+ var weakCount = this.currentWave * this.zombieTypes[0].baseCount;
+ var fastCount = this.currentWave * this.zombieTypes[1].baseCount;
+ var toughCount = this.currentWave * this.zombieTypes[2].baseCount;
+ return {
+ weakCount: weakCount,
+ fastCount: fastCount,
+ toughCount: toughCount,
+ total: weakCount + fastCount + toughCount
};
- composition.total = composition.weakCount + composition.fastCount + composition.toughCount;
- return composition;
},
- spawnWaveZombies: function spawnWaveZombies(zombieComposition) {
- for (var i = 0; i < zombieComposition.weakCount; i++) {
- this.spawnZombie(WeakZombie);
+ spawnWaveZombies: function spawnWaveZombies(composition) {
+ // Spawn the zombies for this wave
+ for (var i = 0; i < composition.weakCount; i++) {
+ var zombie = new this.zombieTypes[0].type();
+ zombie.spawn();
}
- for (var j = 0; j < zombieComposition.fastCount; j++) {
- this.spawnZombie(FastZombie);
+ for (var i = 0; i < composition.fastCount; i++) {
+ var zombie = new this.zombieTypes[1].type();
+ zombie.spawn();
}
- for (var k = 0; k < zombieComposition.toughCount; k++) {
- this.spawnZombie(ToughZombie);
+ for (var i = 0; i < composition.toughCount; i++) {
+ var zombie = new this.zombieTypes[2].type();
+ zombie.spawn();
}
},
- spawnZombie: function spawnZombie(ZombieClass) {
- var zombie = new ZombieClass();
- zombie.x = 2048;
- zombie.y = Math.random() * 2732;
- zombies.push(zombie);
- game.addChild(zombie);
- },
spawnPowerUp: function spawnPowerUp() {
+ // Spawn a random power-up
var powerUp = new PowerUp();
- powerUp.x = 2048;
- powerUp.y = Math.random() * 2732;
- powerUps.push(powerUp);
- game.addChild(powerUp);
+ powerUp.spawn();
},
zombieKilled: function zombieKilled() {
- this.zombiesRemaining--;
+ var _this2 = this;
+ // Update zombie counts when one is killed
this.zombiesKilled++;
- if (scoreTxt) {
- scoreTxt.setText('Score: ' + score + ' | Zombies Killed: ' + this.zombiesKilled);
+ this.zombiesRemaining--;
+ if (this.zombiesRemaining <= 0) {
+ LK.setTimeout(function () {
+ _this2.startNextWave();
+ }, this.waveCooldown);
}
- if (killedZombieText) {
- killedZombieText.setText('Zombies Killed: ' + this.zombiesKilled);
- }
}
};
var background = game.attachAsset('background', {
anchorX: 0,
@@ -405,9 +439,9 @@
}
}
}
// Wave System Management
- if (LK.ticks % WaveSystem.waveCooldown === 3000) {
+ if (LK.ticks % WaveSystem.waveCooldown === 0) {
if (zombies.length === 0) {
WaveSystem.startNextWave();
}
}
make player like this style
make full legs of this player
bullet. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
more dangorous
make horror
red heart. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
rename text to -- Zombie Killed