User prompt
build a level structure in the game. each level will have a defined number of waves, enemy2 and a boss.
User prompt
improve game performance
User prompt
Please fix the bug: 'ReferenceError: enemies is not defined' in or related to this line: 'enemies.push(newBlock);' Line Number: 504
User prompt
rename enemies to blocks
User prompt
create levels to make the game more interesting
Code edit (1 edits merged)
Please save this source code
User prompt
spawn fairy 200 pixels higher
User prompt
when fairy image is mirrored move fairy particles 30 pixels to the right
User prompt
move fairy particles 30 pixels to the left
User prompt
make sure ghost image is also mirrored when going right
User prompt
Please fix the bug: 'ReferenceError: Boss is not defined' in or related to this line: 'if (bullets[k].intersects(enemies[l]) && !(enemies[l] instanceof Boss)) {' Line Number: 571
User prompt
make sure boss enemy tupe uses the asset selected int he wave configuration
Code edit (1 edits merged)
Please save this source code
User prompt
When a wave has boss type, also allow to select the asset this boss will use
User prompt
if enemy type is boss, it should move in the top 1/3 of the screen and shoot bullets downards
Code edit (1 edits merged)
Please save this source code
User prompt
add an attribute to define what type of enemy it is in the waveconfig
User prompt
do not respawn enemies after powerup menu
User prompt
Please fix the bug: 'ReferenceError: enemies is not defined' in or related to this line: 'if (enemies.length === 0) {' Line Number: 612
User prompt
rename enemies to blocks
User prompt
use shield asset for shield up
User prompt
shield should be destroy and destroy an enemy on touch
User prompt
shield should move in the same places like the fairy
User prompt
when shield up is selected...ad a shield around the fairy that lasts until fairy hits with an enemy
Code edit (1 edits merged)
Please save this source code
/**** 
* Classes
****/ 
// Boss class
var Boss = Container.expand(function () {
	var self = Container.call(this);
	var bossGraphics = self.attachAsset('block', {
		anchorX: 0.5,
		anchorY: 0.5,
		tint: 0xff0000 // Boss is red
	});
	self.speed = 2;
	self.hitpoints = 20; // Boss has more hitpoints
	self.update = function () {
		self.y += self.speed;
		if (LK.ticks % 120 < 60) {
			self.scale.x += 0.002;
			self.scale.y += 0.002;
		} else {
			self.scale.x -= 0.002;
			self.scale.y -= 0.002;
		}
		if (!self.hitpointsDisplay) {
			self.hitpointsDisplay = new Text2(self.hitpoints.toString(), {
				size: 100,
				fill: "#ffffff",
				stroke: "#000000",
				strokeThickness: 5
			});
			self.hitpointsDisplay.anchor.set(0.5, 0.5);
			self.hitpointsDisplay.y = 0;
			self.addChild(self.hitpointsDisplay);
		} else if (LK.ticks % 10 === 0) {
			self.hitpointsDisplay.setText(self.hitpoints.toString());
		}
	};
});
// Bullet class
var Bullet = Container.expand(function () {
	var self = Container.call(this);
	var bulletGraphics = self.attachAsset('bullet', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = -5; // Default bullet speed, can be overridden
	self.update = function () {
		self.y += self.speed;
	};
});
// Diamond class
var Diamond = Container.expand(function () {
	var self = Container.call(this);
	var diamondGraphics = self.attachAsset('diamond', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = 4;
	self.update = function () {
		self.y += self.speed;
		self.rotation += 0.05; // Add rotation animation
		if (LK.ticks % 120 < 60) {
			self.scale.x += 0.002;
			self.scale.y += 0.002;
		} else {
			self.scale.x -= 0.002;
			self.scale.y -= 0.002;
		}
		if (self.y > 2732) {
			self.destroy();
		}
	};
});
// Enemy class
var Enemy = Container.expand(function () {
	var self = Container.call(this);
	var enemyGraphics = self.attachAsset('block', {
		anchorX: 0.5,
		anchorY: 0.5,
		tint: 0xffffff // Default tint, will be overridden by wave configuration
	});
	self.speed = 3;
	self.hitpoints = 3; // Add hitpoints to enemies
	self.update = function () {
		self.y += self.speed;
		// Logic to increase and decrease block sizes
		if (LK.ticks % 120 < 60) {
			self.scale.x += 0.002;
			self.scale.y += 0.002;
		} else {
			self.scale.x -= 0.002;
			self.scale.y -= 0.002;
		}
		// Create and update hitpoints display
		if (!self.hitpointsDisplay) {
			self.hitpointsDisplay = new Text2(self.hitpoints.toString(), {
				size: 100,
				fill: "#ffffff",
				stroke: "#000000",
				strokeThickness: 5
			});
			self.hitpointsDisplay.anchor.set(0.5, 0.5);
			self.hitpointsDisplay.y = 0;
			self.addChild(self.hitpointsDisplay);
		} else if (LK.ticks % 10 === 0) {
			self.hitpointsDisplay.setText(self.hitpoints.toString());
		}
	};
});
//<Assets used in the game will automatically appear here>
// Fairy class
var Fairy = Container.expand(function () {
	var self = Container.call(this);
	var fairyGraphics = self.attachAsset('fairy', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = 5;
	self.particles = [];
	self.update = function () {
		// Particle emitter logic
		if (LK.ticks % 5 === 0) {
			var particle = LK.getAsset('fairyemitter', {
				anchorX: 0.5,
				anchorY: 0.5,
				alpha: 1,
				scaleX: 12,
				scaleY: 12
			});
			particle.x = self.x + (self.scale.x === -1 ? 30 : -30);
			particle.y = self.y + self.height / 2;
			particle.speedX = (Math.random() - 0.5) * 2;
			particle.speedY = Math.random() * 2 + 1; // Push particles downwards
			particle.update = function () {
				this.x += this.speedX;
				this.y += this.speedY;
				this.alpha -= 0.01;
				if (this.alpha <= 0) {
					this.destroy();
				}
			};
			self.particles.push(particle);
			game.addChild(particle);
		}
		// Update existing particles
		for (var i = self.particles.length - 1; i >= 0; i--) {
			self.particles[i].update();
			if (self.particles[i].alpha <= 0) {
				self.particles.splice(i, 1);
			}
		}
		// Fairy movement logic
	};
});
// Powerup class
var Powerup = Container.expand(function () {
	var self = Container.call(this);
	var powerupGraphics = self.attachAsset('powerup', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = 3;
	self.update = function () {
		self.y += self.speed;
		if (self.y > 2732) {
			self.destroy();
		}
	};
});
// Star class
var Star = Container.expand(function () {
	var self = Container.call(this);
	var starGraphics = self.attachAsset('star', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = 5;
	self.update = function () {
		self.y += self.speed;
		if (self.y > 2732) {
			self.y = -5;
			self.x = Math.random() * 2048;
		}
	};
});
/**** 
* Initialize Game
****/ 
var game = new LK.Game({
	backgroundColor: 0x800080 //Init game with purple background
});
/**** 
* Game Code
****/ 
// Initialize variables
var fairy;
var bullets = [];
var enemies = [];
var scoreTxt;
var score = 0;
var dragNode = null;
var diamondCount = 0; // Initialize diamond counter
var diamondCounterTxt; // Declare diamondCounterTxt variable
var isFairyHeld = false; // Track if the fairy is being held
var waveCount = 0; // Track the wave count
var waveConfig = [{
	enemies: 3,
	hitpoints: [1],
	tints: [0xffe066]
}, {
	enemies: 6,
	hitpoints: [2, 1],
	tints: [0xcc66ff, 0xffe066]
}, {
	enemies: 9,
	hitpoints: [3, 2, 1],
	tints: [0xff6666, 0xcc66ff, 0xffe066]
}, {
	enemies: 12,
	hitpoints: [4, 3, 2, 1],
	tints: [0xff3333, 0xff6666, 0xcc66ff, 0xffe066]
}, {
	enemies: 15,
	hitpoints: [5, 4, 3, 2, 1],
	tints: [0xff0000, 0xff3333, 0xff6666, 0xcc66ff, 0xffe066]
}, {
	boss: true,
	hitpoints: [20],
	tints: [0xff0000]
}];
// Initialize game elements
function initGame() {
	// Create and position the fairy
	fairy = game.addChild(new Fairy());
	fairy.particles = [];
	fairy.x = 2048 / 2;
	fairy.y = 2732 - 400;
	// Create score text
	scoreTxt = new Text2('0', {
		size: 200,
		fill: "#ffffff",
		stroke: "#000000",
		strokeThickness: 5
	});
	scoreTxt.anchor.set(0.5, 0); // Anchor to the top center
	scoreTxt.x = 2048 / 2; // Position at the top center of the screen
	scoreTxt.y = 20; // Position with a margin from the top
	for (var i = 0; i < 30; i++) {
		var star = game.addChild(new Star());
		star.x = Math.random() * 2048;
		star.y = Math.random() * 2732;
	}
	scoreTxt.anchor.set(0.5, 0);
	// Create coin counter text
	game.addChild(scoreTxt);
	// Create coin counter text
	var overlay = LK.getAsset('menu', {
		width: 2048,
		height: 250,
		color: 0x000000,
		alpha: 0.5,
		anchorX: 0.5,
		anchorY: 0
	});
	overlay.x = 2048 / 2;
	overlay.y = 0;
	game.addChild(overlay);
	var diamondCounterContainer = new Container();
	var diamondIcon = LK.getAsset('diamond', {
		anchorX: 1,
		anchorY: 0,
		alpha: 0.8,
		scaleX: 1.4,
		scaleY: 1.4
	});
	diamondIcon.x = 2048 - 100;
	diamondIcon.y = 20;
	diamondCounterContainer.addChild(diamondIcon);
	diamondCounterTxt = new Text2('0', {
		size: 120,
		fill: "#ffffff",
		stroke: "#000000",
		strokeThickness: 5
	});
	diamondCounterTxt.anchor.set(0.5, 0.5);
	diamondCounterTxt.x = diamondIcon.x + diamondIcon.width / 2 - 230;
	diamondCounterTxt.y = diamondIcon.y + diamondIcon.height / 2 + 15;
	diamondCounterContainer.addChild(diamondCounterTxt);
	game.addChild(diamondCounterContainer);
	// Set up game event listeners
	game.down = function (x, y, obj) {
		dragNode = fairy;
		isFairyHeld = true; // Set isFairyHeld to true when the fairy is held
	};
	game.up = function (x, y, obj) {
		dragNode = null;
		isFairyHeld = false; // Set isFairyHeld to false when the fairy is released
	};
	game.move = handleMove;
	// Update game every tick
	game.update = updateGame;
}
// Handle move events
function handleMove(x, y, obj) {
	if (dragNode) {
		// Check if the fairy is moving to the right
		if (x > dragNode.x) {
			// Mirror the fairy image
			dragNode.scale.x = -1;
		} else {
			// Reset the fairy image
			dragNode.scale.x = 1;
		}
		// Create a ghost image of the fairy when it moves every other frame
		if (LK.ticks % 4 === 0) {
			var ghostFairy = LK.getAsset('fairy', {
				anchorX: 0.5,
				anchorY: 0.5,
				alpha: 0.3
			});
			ghostFairy.x = dragNode.x;
			ghostFairy.y = dragNode.y;
			if (dragNode.parent === game) {
				game.addChildAt(ghostFairy, game.getChildIndex(dragNode));
			} else {
				game.addChild(ghostFairy);
			}
			if (dragNode.scale.x === -1) {
				ghostFairy.scale.x = -1;
			}
			// Remove the ghost image after 0.5 seconds
			LK.setTimeout(function () {
				ghostFairy.destroy();
			}, 250);
		}
		dragNode.x += (x - dragNode.x) * 0.1;
		if (y > 2732 * 0.6) {
			dragNode.y += (y - dragNode.y) * 0.1;
		} else {
			dragNode.y += (2732 * 0.6 - dragNode.y) * 0.1;
		}
	}
}
// Update game logic
function updateGame() {
	// Update starfield
	for (var i = game.children.length - 1; i >= 0; i--) {
		if (game.children[i] instanceof Star) {
			game.children[i].update();
		}
		if (game.children[i] instanceof Diamond && game.children[i].intersects(fairy)) {
			game.children[i].destroy();
			diamondCount++;
			diamondCounterTxt.setText(diamondCount);
		}
	}
	// Update bullets
	for (var i = bullets.length - 1; i >= 0; i--) {
		if (bullets[i] instanceof Bullet) {
			bullets[i].update();
		}
		bullets[i].update();
		if (bullets[i].y < -50) {
			bullets[i].destroy();
			bullets.splice(i, 1);
		}
	}
	for (var j = enemies.length - 1; j >= 0; j--) {
		enemies[j].update();
		if (enemies[j].y > 2732 + 50) {
			enemies[j].destroy();
			enemies.splice(j, 1);
		}
		if (fairy.intersects(enemies[j])) {
			var fairyX = fairy.x;
			var fairyY = fairy.y;
			// Create particle effect for fairy
			for (var p = 0; p < 10; p++) {
				var particle = LK.getAsset('star', {
					anchorX: 0.5,
					anchorY: 0.5,
					alpha: 1
				});
				particle.x = fairyX;
				particle.y = fairyY;
				particle.speedX = (Math.random() - 0.5) * 10;
				particle.speedY = (Math.random() - 0.5) * 10;
				particle.update = function () {
					this.x += this.speedX;
					this.y += this.speedY;
					this.alpha -= 0.02;
					if (this.alpha <= 0) {
						this.destroy();
					}
				};
				game.addChild(particle);
			}
			LK.effects.flashScreen(0xff0000, 1000);
			LK.showGameOver();
		}
		for (var k = bullets.length - 1; k >= 0; k--) {
			if (bullets[k].intersects(enemies[j])) {
				bullets[k].destroy();
				bullets.splice(k, 1);
				enemies[j].hitpoints--;
				if (enemies[j].hitpoints <= 0) {
					var enemyX = enemies[j].x;
					var enemyY = enemies[j].y;
					// Create particle effect
					for (var p = 0; p < 20; p++) {
						var particle = LK.getAsset('star', {
							anchorX: 0.5,
							anchorY: 0.5,
							alpha: 1,
							scaleX: 2,
							scaleY: 2,
							tint: enemies[j].children[0].tint
						});
						particle.x = enemyX;
						particle.y = enemyY;
						particle.speedX = (Math.random() - 0.5) * 10;
						particle.speedY = (Math.random() - 0.5) * 10;
						particle.update = function () {
							this.x += this.speedX;
							this.y += this.speedY;
							this.alpha -= 0.02;
							if (this.alpha <= 0) {
								this.destroy();
							}
						};
						game.addChild(particle);
					}
					enemies[j].destroy();
					enemies.splice(j, 1);
					if (enemies[j]) {
						score += enemies[j].hitpoints * 10;
					}
					scoreTxt.setText(score);
					var dropChance = Math.random();
					if (dropChance < 0.2) {
						var newDiamond = new Diamond();
						newDiamond.x = enemyX;
						newDiamond.y = enemyY;
						game.addChild(newDiamond);
					} else if (dropChance < 0.2) {
						var newPowerup = new Powerup();
						newPowerup.x = enemyX;
						newPowerup.y = enemyY;
						game.addChild(newPowerup);
					}
				}
				break;
			}
		}
	}
	// Check for collisions
	// Check for coin collection
	for (var i = game.children.length - 1; i >= 0; i--) {
		if (game.children[i] instanceof Diamond && game.children[i].intersects(fairy)) {
			game.children[i].destroy();
			diamondCount++;
			diamondCounterTxt.setText('Diamonds: ' + diamondCount);
		}
	}
	for (var k = bullets.length - 1; k >= 0; k--) {
		for (var l = enemies.length - 1; l >= 0; l--) {
			if (bullets[k].intersects(enemies[l]) && !(enemies[l] instanceof Boss)) {
				bullets[k].destroy();
				bullets.splice(k, 1);
				enemies[l].hitpoints--;
				if (enemies[l].hitpoints <= 0) {
					var enemyX = enemies[l].x;
					var enemyY = enemies[l].y;
					enemies[l].destroy();
					enemies.splice(l, 1);
					if (enemies[l]) {
						score += enemies[l].hitpoints * 10;
					}
					scoreTxt.setText(score);
					// Randomly drop coins or powerups
					var dropChance = Math.random();
					if (dropChance < 0.2) {
						var newDiamond = new Diamond();
						newDiamond.x = enemyX;
						newDiamond.y = enemyY;
						game.addChild(newDiamond);
					} else if (dropChance < 0.2) {
						var newPowerup = new Powerup();
						newPowerup.x = enemyX;
						newPowerup.y = enemyY;
						game.addChild(newPowerup);
					}
				}
				break;
			}
		}
	}
	// Spawn new bullets
	if (LK.ticks % 30 == 0 && isFairyHeld) {
		// Only spawn new bullets if the fairy is being held
		var newBullet = new Bullet();
		newBullet.x = fairy.x;
		newBullet.y = fairy.y - fairy.height / 2;
		bullets.push(newBullet);
		game.addChild(newBullet);
	}
	// Spawn new enemies in a line
	if (LK.ticks % 600 == 0) {
		if (enemies.length === 0) {
			waveCount++;
		}
		if (waveCount <= waveConfig.length || enemies.length === 0) {
			if (waveCount > waveConfig.length) {
				waveCount = 1; // Reset wave count to 1 if all waves are complete
				// Add 1 hit point to each enemy
				for (var i = 0; i < waveConfig.length; i++) {
					for (var j = 0; j < waveConfig[i].hitpoints.length; j++) {
						waveConfig[i].hitpoints[j]++;
					}
				}
			}
			var currentWave = waveConfig[waveCount - 1];
			if (currentWave.boss) {
				var newBoss = new Boss();
				newBoss.hitpoints = currentWave.hitpoints[0];
				newBoss.x = 2048 / 2;
				newBoss.y = -newBoss.height / 2;
				enemies.push(newBoss);
				game.addChild(newBoss);
			} else {
				var maxEnemiesPerLine = 3;
				var enemySpacing = 2048 / (maxEnemiesPerLine + 1); // Adjust spacing to center enemies
				var totalRows = Math.ceil(currentWave.enemies / maxEnemiesPerLine);
				for (var i = 0; i < currentWave.enemies; i++) {
					var newBlock = new Enemy();
					var row = Math.floor(i / maxEnemiesPerLine);
					newBlock.hitpoints = currentWave.hitpoints[row] || currentWave.hitpoints[currentWave.hitpoints.length - 1];
					newBlock.x = i % maxEnemiesPerLine * enemySpacing + enemySpacing / 2 - newBlock.width / 2;
					newBlock.y = row * 220 - 50; // Increase row spacing by 20 pixels
					newBlock.children[0].tint = currentWave.tints[row] || currentWave.tints[currentWave.tints.length - 1];
					enemies.push(newBlock);
					game.addChild(newBlock);
				}
				// Center the rows of enemies
				var totalWidth = (Math.min(currentWave.enemies, maxEnemiesPerLine) - 1) * enemySpacing;
				var offsetX = (2048 - totalWidth) / 2;
				for (var j = 0; j < enemies.length; j++) {
					enemies[j].x += offsetX - enemies[j].width / 2;
				}
			}
			var currentWave = waveConfig[waveCount - 1];
			var maxEnemiesPerLine = 3;
			var enemySpacing = 2048 / (maxEnemiesPerLine + 1); // Adjust spacing to center enemies
			var totalRows = Math.ceil(currentWave.enemies / maxEnemiesPerLine);
			for (var i = 0; i < currentWave.enemies; i++) {
				var newBlock = new Enemy();
				var row = Math.floor(i / maxEnemiesPerLine);
				newBlock.hitpoints = currentWave.hitpoints[row] || currentWave.hitpoints[currentWave.hitpoints.length - 1];
				newBlock.x = i % maxEnemiesPerLine * enemySpacing + enemySpacing / 2 - newBlock.width / 2;
				newBlock.y = row * 220 - 50; // Increase row spacing by 20 pixels
				newBlock.children[0].tint = currentWave.tints[row] || currentWave.tints[currentWave.tints.length - 1];
				enemies.push(newBlock);
				game.addChild(newBlock);
			}
			// Center the rows of enemies
			var totalWidth = (Math.min(currentWave.enemies, maxEnemiesPerLine) - 1) * enemySpacing;
			var offsetX = (2048 - totalWidth) / 2;
			for (var j = 0; j < enemies.length; j++) {
				enemies[j].x += offsetX - enemies[j].width / 2;
			}
		}
	}
}
// Initialize the game
initGame(); ===================================================================
--- original.js
+++ change.js
@@ -1,28 +1,26 @@
 /**** 
 * Classes
 ****/ 
-// Block class
-var Block = Container.expand(function () {
+// Boss class
+var Boss = Container.expand(function () {
 	var self = Container.call(this);
-	var blockGraphics = self.attachAsset('block', {
+	var bossGraphics = self.attachAsset('block', {
 		anchorX: 0.5,
 		anchorY: 0.5,
-		tint: 0xffffff // Default tint, will be overridden by wave configuration
+		tint: 0xff0000 // Boss is red
 	});
-	self.speed = 3;
-	self.hitpoints = 3; // Add hitpoints to blocks
+	self.speed = 2;
+	self.hitpoints = 20; // Boss has more hitpoints
 	self.update = function () {
 		self.y += self.speed;
-		// Logic to increase and decrease block sizes
 		if (LK.ticks % 120 < 60) {
 			self.scale.x += 0.002;
 			self.scale.y += 0.002;
 		} else {
 			self.scale.x -= 0.002;
 			self.scale.y -= 0.002;
 		}
-		// Create and update hitpoints display
 		if (!self.hitpointsDisplay) {
 			self.hitpointsDisplay = new Text2(self.hitpoints.toString(), {
 				size: 100,
 				fill: "#ffffff",
@@ -71,8 +69,44 @@
 			self.destroy();
 		}
 	};
 });
+// Enemy class
+var Enemy = Container.expand(function () {
+	var self = Container.call(this);
+	var enemyGraphics = self.attachAsset('block', {
+		anchorX: 0.5,
+		anchorY: 0.5,
+		tint: 0xffffff // Default tint, will be overridden by wave configuration
+	});
+	self.speed = 3;
+	self.hitpoints = 3; // Add hitpoints to enemies
+	self.update = function () {
+		self.y += self.speed;
+		// Logic to increase and decrease block sizes
+		if (LK.ticks % 120 < 60) {
+			self.scale.x += 0.002;
+			self.scale.y += 0.002;
+		} else {
+			self.scale.x -= 0.002;
+			self.scale.y -= 0.002;
+		}
+		// Create and update hitpoints display
+		if (!self.hitpointsDisplay) {
+			self.hitpointsDisplay = new Text2(self.hitpoints.toString(), {
+				size: 100,
+				fill: "#ffffff",
+				stroke: "#000000",
+				strokeThickness: 5
+			});
+			self.hitpointsDisplay.anchor.set(0.5, 0.5);
+			self.hitpointsDisplay.y = 0;
+			self.addChild(self.hitpointsDisplay);
+		} else if (LK.ticks % 10 === 0) {
+			self.hitpointsDisplay.setText(self.hitpoints.toString());
+		}
+	};
+});
 //<Assets used in the game will automatically appear here>
 // Fairy class
 var Fairy = Container.expand(function () {
 	var self = Container.call(this);
@@ -108,11 +142,10 @@
 			game.addChild(particle);
 		}
 		// Update existing particles
 		for (var i = self.particles.length - 1; i >= 0; i--) {
-			var particle = self.pparticles[i];
-			particle.update();
-			if (particle.alpha <= 0) {
+			self.particles[i].update();
+			if (self.particles[i].alpha <= 0) {
 				self.particles.splice(i, 1);
 			}
 		}
 		// Fairy movement logic
@@ -162,9 +195,9 @@
 ****/ 
 // Initialize variables
 var fairy;
 var bullets = [];
-var blocks = [];
+var enemies = [];
 var scoreTxt;
 var score = 0;
 var dragNode = null;
 var diamondCount = 0; // Initialize diamond counter
@@ -178,17 +211,25 @@
 }, {
 	enemies: 6,
 	hitpoints: [2, 1],
 	tints: [0xcc66ff, 0xffe066]
-}
-/**** , {
-enemies: 9,
-hitpoints: [3, 2, 1],
-tints: [0xff6666, 0xcc66ff, 0xffe066]
-}
-****/ 
-// Add more wave configurations as needed
-];
+}, {
+	enemies: 9,
+	hitpoints: [3, 2, 1],
+	tints: [0xff6666, 0xcc66ff, 0xffe066]
+}, {
+	enemies: 12,
+	hitpoints: [4, 3, 2, 1],
+	tints: [0xff3333, 0xff6666, 0xcc66ff, 0xffe066]
+}, {
+	enemies: 15,
+	hitpoints: [5, 4, 3, 2, 1],
+	tints: [0xff0000, 0xff3333, 0xff6666, 0xcc66ff, 0xffe066]
+}, {
+	boss: true,
+	hitpoints: [20],
+	tints: [0xff0000]
+}];
 // Initialize game elements
 function initGame() {
 	// Create and position the fairy
 	fairy = game.addChild(new Fairy());
@@ -315,23 +356,24 @@
 		}
 	}
 	// Update bullets
 	for (var i = bullets.length - 1; i >= 0; i--) {
-		var bullet = bullets[i];
-		bullet.update();
-		if (bullet.y < -50) {
-			bullet.destroy();
+		if (bullets[i] instanceof Bullet) {
+			bullets[i].update();
+		}
+		bullets[i].update();
+		if (bullets[i].y < -50) {
+			bullets[i].destroy();
 			bullets.splice(i, 1);
 		}
 	}
-	for (var j = blocks.length - 1; j >= 0; j--) {
-		var block = blocks[j];
-		block.update();
-		if (block.y > 2732 + 50) {
-			block.destroy();
-			blocks.splice(j, 1);
+	for (var j = enemies.length - 1; j >= 0; j--) {
+		enemies[j].update();
+		if (enemies[j].y > 2732 + 50) {
+			enemies[j].destroy();
+			enemies.splice(j, 1);
 		}
-		if (fairy.intersects(block)) {
+		if (fairy.intersects(enemies[j])) {
 			var fairyX = fairy.x;
 			var fairyY = fairy.y;
 			// Create particle effect for fairy
 			for (var p = 0; p < 10; p++) {
@@ -357,28 +399,27 @@
 			LK.effects.flashScreen(0xff0000, 1000);
 			LK.showGameOver();
 		}
 		for (var k = bullets.length - 1; k >= 0; k--) {
-			var bullet = bullets[k];
-			if (bullet.intersects(block)) {
-				bullet.destroy();
+			if (bullets[k].intersects(enemies[j])) {
+				bullets[k].destroy();
 				bullets.splice(k, 1);
-				block.hitpoints--;
-				if (block.hitpoints <= 0) {
-					var blockX = block.x;
-					var blockY = block.y;
+				enemies[j].hitpoints--;
+				if (enemies[j].hitpoints <= 0) {
+					var enemyX = enemies[j].x;
+					var enemyY = enemies[j].y;
 					// Create particle effect
 					for (var p = 0; p < 20; p++) {
 						var particle = LK.getAsset('star', {
 							anchorX: 0.5,
 							anchorY: 0.5,
 							alpha: 1,
 							scaleX: 2,
 							scaleY: 2,
-							tint: block.children[0].tint
+							tint: enemies[j].children[0].tint
 						});
-						particle.x = blockX;
-						particle.y = blockY;
+						particle.x = enemyX;
+						particle.y = enemyY;
 						particle.speedX = (Math.random() - 0.5) * 10;
 						particle.speedY = (Math.random() - 0.5) * 10;
 						particle.update = function () {
 							this.x += this.speedX;
@@ -389,24 +430,24 @@
 							}
 						};
 						game.addChild(particle);
 					}
-					block.destroy();
-					blocks.splice(j, 1);
-					if (block) {
-						score += block.hitpoints * 10;
+					enemies[j].destroy();
+					enemies.splice(j, 1);
+					if (enemies[j]) {
+						score += enemies[j].hitpoints * 10;
 					}
 					scoreTxt.setText(score);
 					var dropChance = Math.random();
 					if (dropChance < 0.2) {
 						var newDiamond = new Diamond();
-						newDiamond.x = blockX;
-						newDiamond.y = blockY;
+						newDiamond.x = enemyX;
+						newDiamond.y = enemyY;
 						game.addChild(newDiamond);
 					} else if (dropChance < 0.2) {
 						var newPowerup = new Powerup();
-						newPowerup.x = blockX;
-						newPowerup.y = blockY;
+						newPowerup.x = enemyX;
+						newPowerup.y = enemyY;
 						game.addChild(newPowerup);
 					}
 				}
 				break;
@@ -465,12 +506,12 @@
 		game.addChild(newBullet);
 	}
 	// Spawn new enemies in a line
 	if (LK.ticks % 600 == 0) {
-		if (blocks.length === 0) {
+		if (enemies.length === 0) {
 			waveCount++;
 		}
-		if (waveCount <= waveConfig.length || blocks.length === 0) {
+		if (waveCount <= waveConfig.length || enemies.length === 0) {
 			if (waveCount > waveConfig.length) {
 				waveCount = 1; // Reset wave count to 1 if all waves are complete
 				// Add 1 hit point to each enemy
 				for (var i = 0; i < waveConfig.length; i++) {
@@ -479,26 +520,55 @@
 					}
 				}
 			}
 			var currentWave = waveConfig[waveCount - 1];
+			if (currentWave.boss) {
+				var newBoss = new Boss();
+				newBoss.hitpoints = currentWave.hitpoints[0];
+				newBoss.x = 2048 / 2;
+				newBoss.y = -newBoss.height / 2;
+				enemies.push(newBoss);
+				game.addChild(newBoss);
+			} else {
+				var maxEnemiesPerLine = 3;
+				var enemySpacing = 2048 / (maxEnemiesPerLine + 1); // Adjust spacing to center enemies
+				var totalRows = Math.ceil(currentWave.enemies / maxEnemiesPerLine);
+				for (var i = 0; i < currentWave.enemies; i++) {
+					var newBlock = new Enemy();
+					var row = Math.floor(i / maxEnemiesPerLine);
+					newBlock.hitpoints = currentWave.hitpoints[row] || currentWave.hitpoints[currentWave.hitpoints.length - 1];
+					newBlock.x = i % maxEnemiesPerLine * enemySpacing + enemySpacing / 2 - newBlock.width / 2;
+					newBlock.y = row * 220 - 50; // Increase row spacing by 20 pixels
+					newBlock.children[0].tint = currentWave.tints[row] || currentWave.tints[currentWave.tints.length - 1];
+					enemies.push(newBlock);
+					game.addChild(newBlock);
+				}
+				// Center the rows of enemies
+				var totalWidth = (Math.min(currentWave.enemies, maxEnemiesPerLine) - 1) * enemySpacing;
+				var offsetX = (2048 - totalWidth) / 2;
+				for (var j = 0; j < enemies.length; j++) {
+					enemies[j].x += offsetX - enemies[j].width / 2;
+				}
+			}
+			var currentWave = waveConfig[waveCount - 1];
 			var maxEnemiesPerLine = 3;
 			var enemySpacing = 2048 / (maxEnemiesPerLine + 1); // Adjust spacing to center enemies
 			var totalRows = Math.ceil(currentWave.enemies / maxEnemiesPerLine);
 			for (var i = 0; i < currentWave.enemies; i++) {
-				var newBlock = new Block();
+				var newBlock = new Enemy();
 				var row = Math.floor(i / maxEnemiesPerLine);
 				newBlock.hitpoints = currentWave.hitpoints[row] || currentWave.hitpoints[currentWave.hitpoints.length - 1];
 				newBlock.x = i % maxEnemiesPerLine * enemySpacing + enemySpacing / 2 - newBlock.width / 2;
 				newBlock.y = row * 220 - 50; // Increase row spacing by 20 pixels
 				newBlock.children[0].tint = currentWave.tints[row] || currentWave.tints[currentWave.tints.length - 1];
-				blocks.push(newBlock);
+				enemies.push(newBlock);
 				game.addChild(newBlock);
 			}
 			// Center the rows of enemies
 			var totalWidth = (Math.min(currentWave.enemies, maxEnemiesPerLine) - 1) * enemySpacing;
 			var offsetX = (2048 - totalWidth) / 2;
-			for (var j = 0; j < blocks.length; j++) {
-				blocks[j].x += offsetX - blocks[j].width / 2;
+			for (var j = 0; j < enemies.length; j++) {
+				enemies[j].x += offsetX - enemies[j].width / 2;
 			}
 		}
 	}
 }
 
 
 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.