User prompt
Please fix the bug: 'TypeError: target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(eclipseWarningText, {' Line Number: 617 βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Change the M to an R
User prompt
Change player name to TM
User prompt
Add a text that says the player who made this game
User prompt
Please fix the bug: 'TypeError: target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(eclipseWarningText, {' Line Number: 599 βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'TypeError: target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(eclipseWarningText, {' Line Number: 590 βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Change the text from V0.2 to V0.3
User prompt
Please fix the bug: 'TypeError: target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(eclipseWarningText, {' Line Number: 582 βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'TypeError: target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(eclipseWarningText, {' Line Number: 572 βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'TypeError: target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(eclipseWarningText, {' Line Number: 563 βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make them light blue
User prompt
Please fix the bug: 'TypeError: target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(eclipseWarningText, {' Line Number: 554 βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the particle effects very small
User prompt
Please fix the bug: 'TypeError: target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(eclipseWarningText, {' Line Number: 545 βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'TypeError: target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(eclipseWarningText, {' Line Number: 536 βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Add white circles that go across the screen and make the transparency 0.9
User prompt
Please fix the bug: 'TypeError: target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(eclipseWarningText, {' Line Number: 527 βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the red X go across the screen
User prompt
Please fix the bug: 'TypeError: target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(eclipseWarningText, {' Line Number: 518 βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
When player explodes add a explosion effect a red X on the middle of the player screeching across the screen
User prompt
Please fix the bug: 'TypeError: target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(eclipseWarningText, {' Line Number: 509 βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'TypeError: target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(eclipseWarningText, {' Line Number: 500 βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'TypeError: target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(eclipseWarningText, {' Line Number: 491 βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'TypeError: target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(eclipseWarningText, {' Line Number: 482 βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'TypeError: target is not an Object. (evaluating 'key in target')' in or related to this line: 'tween(eclipseWarningText, {' Line Number: 473
/**** 
* Plugins
****/ 
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/**** 
* Classes
****/ 
var BlueCube = Container.expand(function () {
	var self = Container.call(this);
	var cubeGraphics = self.attachAsset('player', {
		anchorX: 0.5,
		anchorY: 0.5,
		scaleX: 0.5,
		scaleY: 0.5,
		tint: 0x0000FF // Blue color
	});
	return self;
});
var Boss = Container.expand(function () {
	var self = Container.call(this);
	var bossGraphics = self.attachAsset('circle', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.laser = new Container();
	self.laserGraphics = self.laser.attachAsset('square', {
		anchorX: 0.5,
		anchorY: 0.5,
		alpha: 0.4
	});
	self.laserGraphics.scaleY = 10; // Make the laser long
	self.laserGraphics.scaleX = 0.1; // Make the laser thin
	self.addChild(self.laser);
	self.laserDirection = {
		x: 0,
		y: 0
	};
	self.laserCooldown = 180; // 3 seconds cooldown
	self.laserActive = false;
	self.laserTimer = 0;
	self.update = function () {
		if (self.laserActive) {
			self.laserTimer++;
			if (self.laserTimer >= self.laserCooldown) {
				self.laserActive = false;
				self.laserTimer = 0;
				self.laserGraphics.alpha = 0.4;
			}
		} else {
			// Aim laser at player
			if (player) {
				var dx = player.x - self.x;
				var dy = player.y - self.y;
				var angle = Math.atan2(dy, dx);
				self.laser.rotation = angle;
				self.laserDirection.x = Math.cos(angle);
				self.laserDirection.y = Math.sin(angle);
			}
			self.laserGraphics.alpha = 0;
			self.laserActive = true;
		}
	};
	self.shootLaser = function () {
		if (self.laserActive) {
			// Check if laser hits player
			if (player && self.intersects(player)) {
				// Player hit by laser
				LK.getSound('explosion').play();
				LK.effects.flashScreen(0xFF0000, 500);
				LK.showGameOver();
			}
		}
	};
	return self;
});
var Obstacle = Container.expand(function (type) {
	var self = Container.call(this);
	if (Math.random() < 0.4) {
		// 40% chance to be a long red obstacle
		type = 'longRedObstacle';
	}
	self.type = type || 'hexagon';
	self.speed = type === 'magentaSquare' ? 40 : type === 'longRedObstacle' ? 2 : 3.5 + Math.random() * 2;
	self.rotationSpeed = (Math.random() - 0.5) * 0.05;
	self.trail = []; // Initialize trail as an empty array to prevent undefined errors
	var shapeGraphics = self.attachAsset(self.type, {
		anchorX: 0.5,
		anchorY: 0.5,
		alpha: self.type === 'square' ? 0.8 : 1 // Set red squares to have a transparency of 0.8
	});
	// Add glowing effect to obstacles
	if (typeof filters !== 'undefined' && typeof filters.GlowFilter !== 'undefined') {
		shapeGraphics.filters = [new filters.GlowFilter({
			color: 0xFFFF00,
			// Yellow color for the glow
			distance: 10,
			// Distance of the glow
			outerStrength: 2,
			// Strength of the glow
			innerStrength: 1 // Inner strength of the glow
		})];
	} else {
		console.warn("GlowFilter is not defined. Skipping glow effect.");
	}
	// Special transformations per shape type
	if (self.type === 'triangle') {
		// Make it a triangle by scaling
		shapeGraphics.scaleY = 0.866; // sqrt(3)/2 to make equilateral triangle
	} else if (self.type === 'longRedObstacle') {
		shapeGraphics.scaleY = 1.8; // Make the obstacle slightly smaller
	} else if (self.type === 'hexagon') {
		// Create hexagon effect using rotation and scale
		self.rotationSpeed = (Math.random() - 0.5) * 0.02; // Slower rotation for hexagons
	}
	self.update = function () {
		// Add trail effect (smaller shapes that follow the obstacle) only if not a long red obstacle
		if (self.type !== 'longRedObstacle') {
			if (!self.trail) {
				self.trail = [];
				self.trailMaxLength = 15;
				self.trailDelay = 2;
				self.trailCounter = 0;
			}
			self.trailCounter++;
			if (self.trailCounter >= self.trailDelay) {
				self.trailCounter = 0;
				// Add new trail point
				if (self.trail.length >= self.trailMaxLength) {
					// Recycle oldest trail point
					var oldestPoint = self.trail.shift();
					oldestPoint.x = self.x;
					oldestPoint.y = self.y;
					self.trail.push(oldestPoint);
				} else {
					// Create new trail point
					var trailPoint = LK.getAsset(self.type, {
						anchorX: 0.5,
						anchorY: 0.5,
						scaleX: 0.7,
						scaleY: 0.7,
						alpha: 0.7,
						tint: 0xFF0000 + (Math.floor(Math.random() * 256) << 8) + Math.floor(Math.random() * 256) // Add color variation
					});
					trailPoint.x = self.x;
					trailPoint.y = self.y;
					self.trail.push(trailPoint);
					game.addChild(trailPoint);
				}
				// Update all trail points opacity
				for (var i = 0; i < self.trail.length; i++) {
					var point = self.trail[i];
					point.alpha = 0.5 * (i / self.trail.length);
				}
			}
		}
		// Move shape downward
		self.y += self.speed;
		// Rotate shape
		shapeGraphics.rotation += self.rotationSpeed;
		// Check if the player is close to the bomb
		if (self.type === 'Bomb' && player && !self.expanding) {
			if (Math.abs(self.x - player.x) < 100 && Math.abs(self.y - player.y) < 100) {
				self.expanding = true;
				tween(self, {
					scaleX: 2,
					scaleY: 2
				}, {
					duration: 1000,
					easing: tween.easeOut,
					onFinish: function onFinish() {
						self.markForRemoval = true;
						// Play explosion sound
						LK.getSound('explosion').play();
						// Create explosion effect
						var explosion = LK.getAsset('circle', {
							anchorX: 0.5,
							anchorY: 0.5,
							scaleX: 1,
							scaleY: 1,
							alpha: 1,
							tint: 0xFF0000 // Red color for the explosion
						});
						explosion.x = self.x;
						explosion.y = self.y;
						game.addChild(explosion);
						// Animate the explosion to expand and fade out
						tween(explosion, {
							scaleX: 3,
							scaleY: 3,
							alpha: 0
						}, {
							duration: 500,
							easing: tween.easeOut,
							onFinish: function onFinish() {
								explosion.destroy();
							}
						});
					}
				});
			}
		}
		// Remove if off screen
		if (self.y > 2832) {
			self.markForRemoval = true;
			// Remove trail effect when obstacle hits the bottom
			for (var i = 0; i < self.trail.length; i++) {
				self.trail[i].destroy();
			}
			self.trail = [];
		}
	};
	return self;
});
var Player = Container.expand(function () {
	var self = Container.call(this);
	var playerGraphics = self.attachAsset('player', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	// Add blue glowing effect to the player
	if (typeof filters !== 'undefined' && typeof filters.GlowFilter !== 'undefined') {
		playerGraphics.filters = [new filters.GlowFilter({
			color: 0x0000FF,
			// Blue color
			distance: 15,
			// Distance of the glow
			outerStrength: 2,
			// Strength of the glow
			innerStrength: 1 // Inner strength of the glow
		})];
	} else {
		console.warn("GlowFilter is not defined. Skipping glow effect.");
	}
	// Add trail effect (smaller circles that follow the player)
	self.trail = [];
	self.trailMaxLength = 5;
	self.trailDelay = 3;
	self.trailCounter = 0;
	self.createTrailPoint = function () {
		var trailPoint = LK.getAsset('player', {
			anchorX: 0.5,
			anchorY: 0.5,
			scaleX: 0.5,
			scaleY: 0.5,
			alpha: 0.5,
			tint: 0xADD8E6 // Light blue color for the trail effect
		});
		trailPoint.x = self.x;
		trailPoint.y = self.y;
		return trailPoint;
	};
	self.updateTrail = function () {
		self.trailCounter++;
		if (!self.blueCubes) {
			self.blueCubes = [new BlueCube(), new BlueCube()];
			game.addChild(self.blueCubes[0]);
			game.addChild(self.blueCubes[1]);
		}
		self.blueCubes[0].x = self.x - 40;
		self.blueCubes[0].y = self.y + 60;
		self.blueCubes[0].rotation += 0.1; // Rotate the first blue cube
		self.blueCubes[1].x = self.x + 40;
		self.blueCubes[1].y = self.y + 60;
		self.blueCubes[1].rotation += 0.1; // Rotate the second blue cube
		if (self.trailCounter >= self.trailDelay) {
			self.trailCounter = 0;
			// Add new trail point
			if (self.trail.length >= self.trailMaxLength) {
				// Recycle oldest trail point
				var oldestPoint = self.trail.shift();
				oldestPoint.x = self.x;
				oldestPoint.y = self.y;
				self.trail.push(oldestPoint);
			} else {
				// Create new trail point
				var newPoint = self.createTrailPoint();
				self.trail.push(newPoint);
				game.addChild(newPoint);
			}
			// Update all trail points opacity
			for (var i = 0; i < self.trail.length; i++) {
				var point = self.trail[i];
				point.alpha = 0.5 * (i / self.trail.length);
			}
		}
	};
	return self;
});
var TitleText = Container.expand(function () {
	var self = Container.call(this);
	self.title = new Text2('Obstacle Escape', {
		size: 100,
		fill: 0xFFFFFF,
		// Original color
		font: "Montserrat" // Change font to Montserrat
	});
	self.title.anchor.set(0.5, 0.5);
	self.addChild(self.title);
	self.subtitle = new Text2('Press Start', {
		size: 60,
		fill: 0xFFFFFF,
		// Original color
		font: "Montserrat" // Change font to Montserrat
	});
	self.subtitle.anchor.set(0.5, 0.5);
	self.subtitle.y = 100;
	self.addChild(self.subtitle);
	// Pulsing animation for the subtitle
	self.pulseAnimation = function () {
		tween(self.subtitle, {
			scaleX: 1.1,
			scaleY: 1.1
		}, {
			duration: 800,
			easing: tween.easeInOut,
			onFinish: function onFinish() {
				tween(self.subtitle, {
					scaleX: 1,
					scaleY: 1
				}, {
					duration: 800,
					easing: tween.easeInOut,
					onFinish: self.pulseAnimation
				});
			}
		});
	};
	self.pulseAnimation();
	return self;
});
/**** 
* Initialize Game
****/ 
var game = new LK.Game({
	backgroundColor: 0x000033
});
/**** 
* Game Code
****/ 
// Game state variables
function _typeof19(o) {
	"@babel/helpers - typeof";
	return _typeof19 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof19(o);
}
function _typeof18(o) {
	"@babel/helpers - typeof";
	return _typeof18 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof18(o);
}
function _typeof17(o) {
	"@babel/helpers - typeof";
	return _typeof17 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof17(o);
}
function _typeof16(o) {
	"@babel/helpers - typeof";
	return _typeof16 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof16(o);
}
function _typeof15(o) {
	"@babel/helpers - typeof";
	return _typeof15 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof15(o);
}
function _typeof14(o) {
	"@babel/helpers - typeof";
	return _typeof14 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof14(o);
}
function _typeof13(o) {
	"@babel/helpers - typeof";
	return _typeof13 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof13(o);
}
function _typeof12(o) {
	"@babel/helpers - typeof";
	return _typeof12 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof12(o);
}
function _typeof11(o) {
	"@babel/helpers - typeof";
	return _typeof11 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof11(o);
}
function _typeof10(o) {
	"@babel/helpers - typeof";
	return _typeof10 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof10(o);
}
function _typeof9(o) {
	"@babel/helpers - typeof";
	return _typeof9 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof9(o);
}
function _typeof8(o) {
	"@babel/helpers - typeof";
	return _typeof8 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof8(o);
}
function _typeof7(o) {
	"@babel/helpers - typeof";
	return _typeof7 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof7(o);
}
function _typeof6(o) {
	"@babel/helpers - typeof";
	return _typeof6 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof6(o);
}
function _typeof5(o) {
	"@babel/helpers - typeof";
	return _typeof5 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof5(o);
}
function _typeof4(o) {
	"@babel/helpers - typeof";
	return _typeof4 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof4(o);
}
function _typeof3(o) {
	"@babel/helpers - typeof";
	return _typeof3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof3(o);
}
function _typeof2(o) {
	"@babel/helpers - typeof";
	return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof2(o);
}
function _typeof(o) {
	"@babel/helpers - typeof";
	return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
		return typeof o;
	} : function (o) {
		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
	}, _typeof(o);
}
var player;
var boss = null;
var obstacles = [];
var isGameStarted = false;
var titleScreen;
var gameTime = 0;
var spawnRate = 60; // Frames between obstacle spawns
var spawnCounter = 0;
var difficulty = 1;
// Setup GUI elements
var backgroundEffectsText; // Define backgroundEffectsText in the global scope
var leaderboardTxt; // Define leaderboardTxt in the global scope
var updateDetailsText; // Define updateDetailsText in the global scope
var scoreTxt = new Text2('0', {
	size: 70,
	fill: 0xFFFFFF,
	font: "Montserrat" // Change font to Montserrat
});
scoreTxt.anchor.set(0.5, 0);
scoreTxt.y = 20;
LK.gui.top.addChild(scoreTxt);
var highScoreTxt = new Text2('Best: 0', {
	size: 40,
	fill: 0xFFFFFF,
	font: "Montserrat" // Change font to Montserrat
});
highScoreTxt.anchor.set(1, 0);
highScoreTxt.x = -20;
highScoreTxt.y = 20;
LK.gui.topRight.addChild(highScoreTxt);
// Create title screen
function setupTitleScreen() {
	titleScreen = new TitleText();
	titleScreen.x = 2048 / 2;
	titleScreen.y = 2732 / 2 - 200;
	game.addChild(titleScreen);
	// Add eclipse warning text
	eclipseWarningText = new Text2('Caution: Intensity!', {
		size: 60,
		fill: 0xFFFFFF,
		// Original color
		font: "Montserrat" // Change font to Montserrat
	});
	eclipseWarningText.anchor.set(0.5, 0.5);
	eclipseWarningText.x = 2048 / 2;
	eclipseWarningText.y = 2732 / 2 + 150; // Position below the title 
	game.addChild(eclipseWarningText);
	// Add update log text
	updateLogText = new Text2('V0.3', {
		size: 50,
		fill: 0xFFFFFF,
		// Original color
		font: "Montserrat" // Change font to Montserrat
	});
	updateLogText.anchor.set(1, 0);
	updateLogText.x = 2048 - 20; // Position on the right of the screen
	updateLogText.y = 150;
	game.addChild(updateLogText);
	// Add flashing effect to eclipse warning text
	function flashWarningText() {
		if (typeof eclipseWarningText !== 'undefined' && eclipseWarningText instanceof Text2) {
			if ((typeof eclipseWarningText === "undefined" ? "undefined" : _typeof19(eclipseWarningText)) === 'object' && eclipseWarningText !== null) {
				tween(eclipseWarningText, {
					alpha: 0
				}, {
					duration: 500,
					easing: tween.easeInOut,
					onFinish: function onFinish() {
						tween(eclipseWarningText, {
							alpha: 1
						}, {
							duration: 500,
							easing: tween.easeInOut,
							onFinish: flashWarningText
						});
					}
				});
			}
		}
	}
	flashWarningText();
	// Load high score
	var highScore = storage.highScore || 0;
	highScoreTxt.setText('Best: ' + highScore);
	var leaderboardTxt = new Text2('Leaderboard: Player1 - ' + highScore, {
		size: 40,
		fill: 0xFFFFFF,
		font: "Montserrat" // Change font to Montserrat
	});
	leaderboardTxt.anchor.set(0.5, 0);
	leaderboardTxt.y = 100;
	game.addChild(leaderboardTxt);
}
// Start the game
function startGame() {
	// Remove title screen if it exists
	if (titleScreen) {
		titleScreen.destroy();
		titleScreen = null;
		if (leaderboardTxt) {
			leaderboardTxt.destroy();
			leaderboardTxt = null;
		}
		if (eclipseWarningText) {
			eclipseWarningText.destroy();
			eclipseWarningText = null;
		}
		if (updateLogText) {
			updateLogText.destroy();
			updateLogText = null;
		}
		if (scoreTxt) {
			scoreTxt.destroy();
			scoreTxt = null;
		}
		if (highScoreTxt) {
			highScoreTxt.destroy();
			highScoreTxt = null;
		}
		if (backgroundEffectsText) {
			backgroundEffectsText.destroy();
			backgroundEffectsText = null;
		}
	}
	// Reset game state
	isGameStarted = true;
	gameTime = 0;
	spawnCounter = 0;
	difficulty = 1;
	LK.setScore(0);
	scoreTxt = new Text2('0', {
		size: 70,
		fill: 0xFFFFFF
	});
	scoreTxt.anchor.set(0.5, 0);
	scoreTxt.y = 20;
	LK.gui.top.addChild(scoreTxt);
	scoreTxt.setText('0');
	// Clear any existing obstacles
	for (var i = obstacles.length - 1; i >= 0; i--) {
		obstacles[i].destroy();
	}
	obstacles = [];
	// Create player
	player = new Player();
	player.x = 2048 / 2;
	player.y = 2732 - 300;
	game.addChild(player);
	// Play dubstep music and loop it
	LK.playMusic('bgMusic', {
		loop: true
	});
}
// Spawn a new obstacle
function spawnObstacle() {
	// Choose a random shape type
	var types = ['circle', 'square', 'triangle', 'hexagon', 'magentaSquare', 'Bomb'];
	var type = types[Math.floor(Math.random() * types.length)];
	// Generate random size for the obstacle
	var randomSize = 50 + Math.random() * 100; // Random size between 50 and 150
	// Create obstacle with random size and color variation
	var obstacle = new Obstacle(type);
	var colorVariation = Math.floor(Math.random() * 256); // Random value between 0 and 255
	obstacle.tint = 0xFF0000 + (colorVariation << 8) + colorVariation; // Apply color variation
	obstacle.scaleX = randomSize / 100; // Scale based on random size
	obstacle.scaleY = randomSize / 100; // Scale based on random size
	// Position randomly along the top of the screen
	obstacle.x = Math.random() * 2048;
	obstacle.y = -100;
	game.addChild(obstacle);
	obstacles.push(obstacle);
	LK.getSound('spawn').play();
}
// Check for collisions between player and obstacles
function checkCollisions() {
	if (!player) {
		return;
	}
	for (var i = 0; i < obstacles.length; i++) {
		if (player.intersects(obstacles[i])) {
			// Collision detected - game over
			LK.getSound('collision').play();
			LK.getSound('explosion').play(); // Play explosion sound when player dies
			LK.effects.flashScreen(0xFF0000, 500);
			// Create a red explosion effect at the player's position
			var explosion = LK.getAsset('circle', {
				anchorX: 0.5,
				anchorY: 0.5,
				scaleX: 1,
				scaleY: 1,
				alpha: 1,
				tint: 0xFF0000 // Red color for the explosion
			});
			explosion.x = player.x;
			explosion.y = player.y;
			game.addChild(explosion);
			// Animate the explosion to expand and fade out
			tween(explosion, {
				scaleX: 3,
				scaleY: 3,
				alpha: 0
			}, {
				duration: 500,
				easing: tween.easeOut,
				onFinish: function onFinish() {
					explosion.destroy();
				}
			});
			// Create a red X effect at the player's position
			var redX = LK.getAsset('longRedObstacle', {
				anchorX: 0.5,
				anchorY: 0.5,
				scaleX: 1,
				scaleY: 0.1,
				alpha: 1,
				tint: 0xFF0000 // Red color for the X
			});
			redX.x = player.x;
			redX.y = player.y;
			game.addChild(redX);
			// Animate the red X to screech across the screen
			tween(redX, {
				rotation: Math.PI / 4,
				// Rotate to form an X
				scaleX: 5,
				// Stretch across the screen
				x: 2048,
				// Move across the screen to the right
				alpha: 0
			}, {
				duration: 1000,
				easing: tween.easeOut,
				onFinish: function onFinish() {
					redX.destroy();
				}
			});
			// Save high score
			var currentScore = LK.getScore();
			var highScore = storage.highScore || 0;
			if (currentScore > highScore) {
				storage.highScore = currentScore;
				highScoreTxt.setText('Best: ' + currentScore);
			}
			// Show game over screen
			LK.showGameOver();
			return;
		}
	}
}
// Update game difficulty
function updateDifficulty() {
	// Increase difficulty over time
	if (gameTime % 600 === 0 && gameTime > 0) {
		// Every 10 seconds
		difficulty += 0.2;
		if (spawnRate > 20) {
			spawnRate -= 5;
		}
	}
	// Increase obstacle speed every 5 points
	if (LK.getScore() % 5 === 0 && LK.getScore() > 0) {
		for (var i = 0; i < obstacles.length; i++) {
			obstacles[i].speed += 0.1;
		}
	}
}
// Handle input events
game.down = function (x, y, obj) {
	if (!isGameStarted) {
		startGame();
	}
};
game.move = function (x, y, obj) {
	if (isGameStarted && player) {
		// Move player to touch position but keep it within game bounds
		player.x = Math.max(50, Math.min(x, 2048 - 50));
		player.y = Math.max(50, Math.min(y, 2732 - 50));
	}
};
// Main game update loop
game.update = function () {
	if (!isGameStarted) {
		// Show title screen if not started
		if (!titleScreen) {
			setupTitleScreen();
		}
		return;
	}
	// Update game time
	gameTime++;
	// Update score (time-based)
	LK.setScore(Math.floor(gameTime / 60)); // Score is in seconds
	scoreTxt.setText(LK.getScore().toString());
	// Update player trail
	if (player) {
		player.updateTrail();
	}
	// Update and spawn obstacles
	spawnCounter++;
	if (spawnCounter >= spawnRate && obstacles.length < 30) {
		spawnCounter = 0;
		spawnObstacle();
	}
	// Make it rain obstacles every 30 points
	if (LK.getScore() % 30 === 0 && LK.getScore() > 0) {
		if (!obstacleRainStartTime) {
			obstacleRainStartTime = gameTime;
			// Show warning text
			var warningText = new Text2('Alert: Incoming Rain!', {
				size: 80,
				fill: 0xFFFFFF,
				// Original color
				font: "Montserrat" // Change font to Montserrat
			});
			warningText.anchor.set(0.5, 0.5);
			warningText.x = 2048 / 2;
			warningText.y = 2732 / 2;
			game.addChild(warningText);
			// Remove warning text after 5 seconds
			LK.setTimeout(function () {
				warningText.destroy();
			}, 5000);
		}
		if (gameTime - obstacleRainStartTime > 300 && gameTime - obstacleRainStartTime <= 600) {
			// 5 seconds at 60 FPS
			for (var i = 0; i < 10; i++) {
				// Spawn 10 obstacles
				var obstacle = new Obstacle();
				obstacle.x = Math.random() * 2048;
				obstacle.y = -100;
				obstacle.speed = 20; // Set speed to 20
				game.addChild(obstacle);
				obstacles.push(obstacle);
			}
		} else if (gameTime - obstacleRainStartTime > 600 && gameTime - obstacleRainStartTime <= 1200) {
			// Additional 10 seconds at 60 FPS
			for (var i = 0; i < 5; i++) {
				// Spawn 5 obstacles
				var obstacle = new Obstacle();
				obstacle.x = Math.random() * 2048;
				obstacle.y = -100;
				obstacle.speed = 15; // Set speed to 15
				game.addChild(obstacle);
				obstacles.push(obstacle);
			}
		} else if (gameTime - obstacleRainStartTime > 600 && gameTime - obstacleRainStartTime <= 660) {
			// Display 'Survived!' text for 1 second
			var survivedText = new Text2('Survived!', {
				size: 80,
				fill: 0xFFFFFF,
				// Original color
				font: "Montserrat" // Change font to Montserrat
			});
			survivedText.anchor.set(0.5, 0.5);
			survivedText.x = 2048 / 2;
			survivedText.y = 2732 / 2;
			game.addChild(survivedText);
			LK.setTimeout(function () {
				survivedText.destroy();
			}, 1000);
		}
	} else {
		obstacleRainStartTime = null;
	}
	// Spawn boss at 60 points
	if (LK.getScore() === 60 && !boss) {
		boss = new Boss();
		boss.x = 2048 / 2;
		boss.y = 200;
		game.addChild(boss);
		LK.getSound('spawn').play();
	}
	// Update boss
	if (boss) {
		boss.update();
		boss.shootLaser();
		if (gameTime % 1200 === 0) {
			// Boss lasts for 20 seconds
			boss.destroy();
			boss = null;
		}
	}
	// Update all obstacles
	for (var i = obstacles.length - 1; i >= 0; i--) {
		obstacles[i].update();
		// Add white circles with transparency 0.9
		if (gameTime % 60 === 0) {
			// Every second
			var whiteCircle = LK.getAsset('circle', {
				anchorX: 0.5,
				anchorY: 0.5,
				alpha: 0.9,
				tint: 0xADD8E6,
				// Light blue color
				scaleX: 0.2,
				// Reduce size
				scaleY: 0.2 // Reduce size
			});
			whiteCircle.x = Math.random() * 2048; // Random x position
			whiteCircle.y = -100; // Start above the screen
			game.addChild(whiteCircle);
			// Animate the white circle to move across the screen
			tween(whiteCircle, {
				y: 2832 // Move to the bottom of the screen
			}, {
				duration: 3000,
				// 3 seconds
				easing: tween.easeOut,
				onFinish: function onFinish() {
					whiteCircle.destroy();
				}
			});
		}
		// Remove obstacles marked for removal
		if (obstacles[i].markForRemoval) {
			obstacles[i].destroy();
			obstacles.splice(i, 1);
		}
	}
	// Check for collisions
	checkCollisions();
	// Update difficulty
	updateDifficulty();
}; ===================================================================
--- original.js
+++ change.js
@@ -341,8 +341,16 @@
 /**** 
 * Game Code
 ****/ 
 // Game state variables
+function _typeof19(o) {
+	"@babel/helpers - typeof";
+	return _typeof19 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
+		return typeof o;
+	} : function (o) {
+		return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
+	}, _typeof19(o);
+}
 function _typeof18(o) {
 	"@babel/helpers - typeof";
 	return _typeof18 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
 		return typeof o;
@@ -546,9 +554,9 @@
 	game.addChild(updateLogText);
 	// Add flashing effect to eclipse warning text
 	function flashWarningText() {
 		if (typeof eclipseWarningText !== 'undefined' && eclipseWarningText instanceof Text2) {
-			if ((typeof eclipseWarningText === "undefined" ? "undefined" : _typeof18(eclipseWarningText)) === 'object' && eclipseWarningText !== null) {
+			if ((typeof eclipseWarningText === "undefined" ? "undefined" : _typeof19(eclipseWarningText)) === 'object' && eclipseWarningText !== null) {
 				tween(eclipseWarningText, {
 					alpha: 0
 				}, {
 					duration: 500,