Changed around line 1
- this.speed = 0.01 + Math.random() * 0.02
+ this.speed = 0.01 + Math.random() * 0.2
Changed around line 56: class Drone {
- update(delta) {
+ update(delta) {
+ if (this.globe.gameOver) return;
Changed around line 172: class Globe {
-
+ this.earthHealth = 1.0; // 1.0 = full health, 0 = dead
+ this.gameOver = false;
Changed around line 576: class Globe {
+
+
- const texture = new THREE.TextureLoader().load("earth_atmos_2048.jpg")
-
- // Use PhongMaterial for better lighting
+ const texture = new THREE.TextureLoader().load("earth_atmos_2048.jpg")
+ emissive: 0xff0000, // Red glow for damage
+ emissiveIntensity: 0 // Start with no damage glow
+
Changed around line 612: class Globe {
+ damageEarth() {
+ if (this.gameOver) return;
+
+ this.earthHealth = Math.max(0, this.earthHealth - 0.1); // Reduce health by 10%
+ this.earth.material.emissiveIntensity = 1 - this.earthHealth; // Increase red glow
+
+ if (this.earthHealth <= 0) {
+ this.triggerGameOver();
+ }
+ }
+
+
+ triggerGameOver() {
+ this.gameOver = true;
+
+ // Create explosion particles
+ const particleCount = 1000;
+ const particles = new THREE.Group();
+
+ for (let i = 0; i < particleCount; i++) {
+ const geometry = new THREE.BoxGeometry(0.02, 0.02, 0.02);
+ const material = new THREE.MeshPhongMaterial({
+ color: Math.random() > 0.5 ? 0xff4444 : 0xff7700,
+ emissive: 0x441111,
+ });
+ const particle = new THREE.Mesh(geometry, material);
+
+ // Position particles on earth's surface
+ const theta = Math.random() * Math.PI * 2;
+ const phi = Math.random() * Math.PI;
+ const radius = 0.5;
+
+ particle.position.x = radius * Math.sin(phi) * Math.cos(theta);
+ particle.position.y = radius * Math.sin(phi) * Math.sin(theta);
+ particle.position.z = radius * Math.cos(phi);
+
+ // Add velocity for explosion
+ const velocity = new THREE.Vector3()
+ .copy(particle.position)
+ .normalize()
+ .multiplyScalar(0.03);
+ particle.velocity = velocity;
+
+ particles.add(particle);
+ }
+
+ this.scene.add(particles);
+ this.explosionParticles = particles;
+
+ // Hide Earth
+ this.earth.visible = false;
+
+ // Create game over text
+ const gameOverDiv = document.createElement('div');
+ gameOverDiv.style.position = 'fixed';
+ gameOverDiv.style.top = '50%';
+ gameOverDiv.style.left = '50%';
+ gameOverDiv.style.transform = 'translate(-50%, -50%)';
+ gameOverDiv.style.color = '#ff0000';
+ gameOverDiv.style.fontSize = '64px';
+ gameOverDiv.style.fontFamily = 'Arial, sans-serif';
+ gameOverDiv.style.fontWeight = 'bold';
+ gameOverDiv.style.textShadow = '0 0 10px #ff0000';
+ gameOverDiv.style.zIndex = '1000';
+ gameOverDiv.innerHTML = `GAME OVER
Score: ${this.score}`;
+ document.body.appendChild(gameOverDiv);
+
+ // Start explosion animation
+ this.animateExplosion();
+ }
+
+ animateExplosion() {
+ if (!this.explosionParticles) return;
+
+ this.explosionParticles.children.forEach(particle => {
+ particle.position.add(particle.velocity);
+ particle.scale.multiplyScalar(0.98);
+ });
+
+ requestAnimationFrame(() => this.animateExplosion());
+ }
+
Changed around line 819: class Globe {
+
+ // Check for drone collisions with Earth
+ this.drones.forEach((drone) => {
+ if (!drone.isExploding) {
+ const distanceFromCenter = drone.position.length();
+ if (distanceFromCenter <= 0.52) { // Slightly larger than Earth's radius (0.5)
+ this.damageEarth();
+ drone.startExplosion();
+ }
+ }
+ });
+