Code edit (4 edits merged)
Please save this source code
User prompt
boss hitpoits and speed should be multiplied by its spawncount. staring always at 1
User prompt
add a counter on each boss to keep track of how many times it has spawned.
Code edit (1 edits merged)
Please save this source code
User prompt
after a level is complete, set its index of wave back to 0
User prompt
make sure boss2 and boss3 also move like boss1
User prompt
ensure currentwaveinde is rested to 0 at the start of each level
User prompt
when level change, check level, and start from first wave on that level
User prompt
when a level is restarted make sure enemy waves are also started again
User prompt
levels should be played in loop. when the first 3 levels are complete, number one should start again, but harder, and so should be the boss
User prompt
add 3 more levels
User prompt
when a new level starts increase speed of start in the background and enemies by 10%
User prompt
when boss3 is destroyed, start level 1 again.
Code edit (1 edits merged)
Please save this source code
User prompt
when diamond is collected play diamondcollect sound
User prompt
Please fix the bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'children')' in or related to this line: 'enemies[j].children[0].tint = 0xffffff; // Revert tint back to white' Line Number: 1051
User prompt
when enemy2 and boss is hit, change tint for a millisecond
User prompt
enemy2 and boss should have a slight effect when hit
User prompt
flicker shoudl last shorter
User prompt
make flicker lighter
User prompt
make enemy2 and boss flicker when they are hit
User prompt
only apply shield when powerup3 is selected, not when powerup1 or powerup2 are
User prompt
remove wait for 2 seconds between boss is destroyed and powerup menu is shown
User prompt
only apply this last big explossion and flash to boss, not all other enemies
User prompt
make boss explossion way bigger and flashier
===================================================================
--- original.js
+++ change.js
@@ -1,16 +1,18 @@
/****
* Classes
****/
+// Global counter for Boss spawns
var Boss = Container.expand(function () {
var self = Container.call(this);
+ bossSpawnCount++; // Increment the counter each time a Boss is spawned
var bossGraphics = self.attachAsset('boss1', {
anchorX: 0.5,
anchorY: 0.5
// Removed tint for the boss
});
self.speed = 2;
- self.hitpoints = 1; // High hitpoints for the boss
+ self.hitpoints = 20; // High hitpoints for the boss
self.update = function () {
self.x += Math.sin(LK.ticks / 30) * 5; // Sideways movement
self.y += Math.cos(LK.ticks / 50) * 3; // Top-down movement
self.x = Math.max(Math.min(self.x, 2048 - self.width / 2), self.width / 2); // Keep within screen bounds horizontally
@@ -38,16 +40,18 @@
game.addChild(newBullet);
}
};
});
+// Global counter for Boss2 spawns
var Boss2 = Container.expand(function () {
var self = Container.call(this);
+ boss2SpawnCount++; // Increment the counter each time a Boss2 is spawned
var bossGraphics = self.attachAsset('boss2', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 2;
- self.hitpoints = 1; // Higher hitpoints for the second boss
+ self.hitpoints = 40; // Higher hitpoints for the second boss
self.update = function () {
self.x += Math.sin(LK.ticks / 30) * 5; // Sideways movement
self.y += Math.cos(LK.ticks / 50) * 3; // Top-down movement
self.x = Math.max(Math.min(self.x, 2048 - self.width / 2), self.width / 2); // Keep within screen bounds horizontally
@@ -73,16 +77,18 @@
game.addChild(newBullet);
}
};
});
+// Global counter for Boss3 spawns
var Boss3 = Container.expand(function () {
var self = Container.call(this);
+ boss3SpawnCount++; // Increment the counter each time a Boss3 is spawned
var bossGraphics = self.attachAsset('boss3', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 2;
- self.hitpoints = 1; // Higher hitpoints for the third boss
+ self.hitpoints = 60; // Higher hitpoints for the third boss
self.update = function () {
self.x += Math.sin(LK.ticks / 30) * 5; // Sideways movement
self.y += Math.cos(LK.ticks / 50) * 3; // Top-down movement
self.x = Math.max(Math.min(self.x, 2048 - self.width / 2), self.width / 2); // Keep within screen bounds horizontally
@@ -253,9 +259,9 @@
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 4.4; // Increase speed by 10%
- self.hitpoints = 1; // Different hitpoints for Enemy2
+ self.hitpoints = 5; // Different hitpoints for Enemy2
self.randomFactorX = Math.random() * 20 + 10; // Ensure a minimum value to reduce shakiness
self.randomFactorY = Math.random() * 10 + 5; // Ensure a minimum value to reduce shakiness
self.update = function () {
self.y += self.speed;
@@ -439,11 +445,8 @@
bullet.speed *= 2; // Double the speed of bullets
});
}
currentLevel.currentWaveIndex = 0; // Reset the current wave index to start from the first wave
- levels.forEach(function (level) {
- level.currentWaveIndex = 0; // Reset the wave index for all levels
- });
} else {
var message = new Text2("I need ".concat(powerupCosts.powerup1 - diamondCount, " more diamonds for this powerup!"), {
size: 100,
fill: "#ffffff",
@@ -753,8 +756,11 @@
/****
* Game Code
****/
// Configuration for powerup costs
+var bossSpawnCount = 0;
+var boss2SpawnCount = 0;
+var boss3SpawnCount = 0;
var powerupCosts = {
powerup1: 10,
powerup2: 20,
powerup3: 30
@@ -779,35 +785,39 @@
waves: [{
enemies: 3,
hitpoints: [1],
tints: [0xffe066]
- /****
- }, {
+ }, {
enemies: 6,
hitpoints: [2, 1],
tints: [0xcc66ff, 0xffe066]
- }, {
+ }, {
enemies: 9,
hitpoints: [3, 2, 1],
- tints: [0xff6666, 0xcc66ff, 0xffe066]
- ****/
+ tints: [0xcc66ff, 0xffe066]
+ }, {
+ enemies: 9,
+ hitpoints: [4, 3, 2],
+ tints: [0xcc66ff, 0xffe066]
}],
boss: true
}, 1), new Level({
waves: [{
- enemies: 3,
- hitpoints: [1],
+ enemies: 6,
+ hitpoints: [4, 3],
tints: [0x66ff66]
- /****
- }, {
- enemies: 8,
- hitpoints: [3, 2],
+ }, {
+ enemies: 9,
+ hitpoints: [5, 4, 3],
tints: [0x66ccff, 0x66ff66]
- }, {
+ }, {
enemies: 12,
- hitpoints: [4, 3, 2],
- tints: []
- ****/
+ hitpoints: [5, 4, 3, 2],
+ tints: [0x66ccff, 0x66ff66]
+ }, {
+ enemies: 12,
+ hitpoints: [6, 5, 4, 3],
+ tints: [0x66ccff, 0x66ff66]
}],
boss: true
}, 2), new Level({
waves: [{
8-bit. cartoon. white star.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cartoon 8 bit fairy dust. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Cartoon, 8bit, fireball. Black border. Cicular.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cartoon, 8 bit, shield. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8bit, cartoon, axe. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
dark electric ball, 8bit, cartoon.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8bit, cartoon, treasure chest frame. very big empty center. only a fine border of chest. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.