Changed around line 56: class Drone {
- update(delta) {
- if (this.globe.gameOver) return;
+ update(delta) {
+ if (this.globe.gameOver) return
Changed around line 110: class Drone {
- this.globe.score++;
- document.getElementById('score-display').textContent = `Drones Destroyed: ${this.globe.score}`;
+ this.globe.score++
+ document.getElementById("score-display").textContent =
+ `Drones Destroyed: ${this.globe.score}`
Changed around line 139: class Drone {
- // Modify the Drone class's updateExplosion method
+ // Modify the Drone class's updateExplosion method
- const elapsed = Date.now() - this.explosionStartTime;
- const progress = elapsed / this.explosionDuration;
+ const elapsed = Date.now() - this.explosionStartTime
+ const progress = elapsed / this.explosionDuration
- this.globe.scene.remove(this.mesh);
- this.globe.scene.remove(this.explosionParticles);
- this.globe.drones = this.globe.drones.filter((d) => d !== this);
-
- return;
+ this.globe.scene.remove(this.mesh)
+ this.globe.scene.remove(this.explosionParticles)
+ this.globe.drones = this.globe.drones.filter((d) => d !== this)
+
+ return
- particle.position.add(particle.velocity);
- particle.scale.multiplyScalar(0.95);
- });
+ particle.position.add(particle.velocity)
+ particle.scale.multiplyScalar(0.95)
+ })
- this.mesh.scale.multiplyScalar(0.9);
+ this.mesh.scale.multiplyScalar(0.9)
Changed around line 173: class Globe {
- this.earthHealth = 1.0; // 1.0 = full health, 0 = dead
- this.gameOver = false;
- this.score = 0;
- this.createScoreDisplay();
+ this.earthHealth = 1.0 // 1.0 = full health, 0 = dead
+ this.gameOver = false
+ this.score = 0
+ this.createScoreDisplay()
Changed around line 195: this.earthHealth = 1.0; // 1.0 = full health, 0 = dead
- this.currentZoom = .7
+ this.currentZoom = 0.7
Changed around line 213: this.earthHealth = 1.0; // 1.0 = full health, 0 = dead
-
- createScoreDisplay() {
- const scoreDisplay = document.createElement("div");
- scoreDisplay.style.position = "fixed";
- scoreDisplay.style.top = "20px";
- scoreDisplay.style.right = "20px";
- scoreDisplay.style.padding = "10px 20px";
- scoreDisplay.style.backgroundColor = "rgba(0, 0, 0, 0.8)";
- scoreDisplay.style.color = "#4CAF50";
- scoreDisplay.style.borderRadius = "10px";
- scoreDisplay.style.fontSize = "24px";
- scoreDisplay.style.fontFamily = "monospace";
- scoreDisplay.style.zIndex = "1000";
- scoreDisplay.style.border = "1px solid rgba(76, 175, 80, 0.3)";
- scoreDisplay.id = "score-display";
- scoreDisplay.textContent = "Drones Destroyed: 0";
- document.body.appendChild(scoreDisplay);
+ createScoreDisplay() {
+ const scoreDisplay = document.createElement("div")
+ scoreDisplay.style.position = "fixed"
+ scoreDisplay.style.top = "20px"
+ scoreDisplay.style.right = "20px"
+ scoreDisplay.style.padding = "10px 20px"
+ scoreDisplay.style.backgroundColor = "rgba(0, 0, 0, 0.8)"
+ scoreDisplay.style.color = "#4CAF50"
+ scoreDisplay.style.borderRadius = "10px"
+ scoreDisplay.style.fontSize = "24px"
+ scoreDisplay.style.fontFamily = "monospace"
+ scoreDisplay.style.zIndex = "1000"
+ scoreDisplay.style.border = "1px solid rgba(76, 175, 80, 0.3)"
+ scoreDisplay.id = "score-display"
+ scoreDisplay.textContent = "Drones Destroyed: 0"
+ document.body.appendChild(scoreDisplay)
-
Changed around line 314: this.earthHealth = 1.0; // 1.0 = full health, 0 = dead
- }else if (e.key.toLowerCase() === " ") {
+ } else if (e.key.toLowerCase() === " ") {
- }
- else if (e.key.toLowerCase() === "f") {
+ } else if (e.key.toLowerCase() === "f") {
Changed around line 341: this.earthHealth = 1.0; // 1.0 = full health, 0 = dead
- triggerSound() {
+ triggerSound() {
Changed around line 574: this.earthHealth = 1.0; // 1.0 = full health, 0 = dead
-
-
- const texture = new THREE.TextureLoader().load("earth_atmos_2048.jpg")
+ const texture = new THREE.TextureLoader().load("earth_atmos_2048.jpg")
- emissive: 0xff0000, // Red glow for damage
- emissiveIntensity: 0 // Start with no damage glow
+ emissive: 0xff0000, // Red glow for damage
+ emissiveIntensity: 0, // Start with no damage glow
-
Changed around line 608: const texture = new THREE.TextureLoader().load("earth_atmos_2048.jpg")
- 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.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
- this.triggerGameOver();
+ this.triggerGameOver()
-
- this.gameOver = true;
-
+ this.gameOver = true
+
- const particleCount = 1000;
- const particles = new THREE.Group();
-
+ const particleCount = 1000
+ const particles = new THREE.Group()
+
- const geometry = new THREE.BoxGeometry(0.02, 0.02, 0.02);
+ const geometry = new THREE.BoxGeometry(0.02, 0.02, 0.02)
- });
- const particle = new THREE.Mesh(geometry, material);
-
+ })
+ const particle = new THREE.Mesh(geometry, material)
+
- 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);
-
+ 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)
+
- .multiplyScalar(0.03);
- particle.velocity = velocity;
-
- particles.add(particle);
+ .multiplyScalar(0.03)
+ particle.velocity = velocity
+
+ particles.add(particle)
-
- this.scene.add(particles);
- this.explosionParticles = particles;
+
+ this.scene.add(particles)
+ this.explosionParticles = particles
- this.earth.visible = false;
+ this.earth.visible = false
- 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);
+ 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)
- this.animateExplosion();
+ this.animateExplosion()
- if (!this.explosionParticles) return;
-
- this.explosionParticles.children.forEach(particle => {
- particle.position.add(particle.velocity);
- particle.scale.multiplyScalar(0.98);
- });
-
- requestAnimationFrame(() => this.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 806: const texture = new THREE.TextureLoader().load("earth_atmos_2048.jpg")
- this.drones.length < this.maxDrones && !this.gameOver
+ this.drones.length < this.maxDrones &&
+ !this.gameOver
- this.droneSpawnInterval = Math.max(10, this.droneSpawnInterval * .95)
+ this.droneSpawnInterval = Math.max(10, this.droneSpawnInterval * 0.95)
-
- const distanceFromCenter = drone.position.length();
- if (distanceFromCenter <= 0.52) { // Slightly larger than Earth's radius (0.5)
- this.damageEarth();
- drone.startExplosion();
+ const distanceFromCenter = drone.position.length()
+ if (distanceFromCenter <= 0.52) {
+ // Slightly larger than Earth's radius (0.5)
+ this.damageEarth()
+ drone.startExplosion()
- });
+ })
Changed around line 918: const texture = new THREE.TextureLoader().load("earth_atmos_2048.jpg")
- if (!document.fullscreenElement) {
- document.body.requestFullscreen().catch((err) => {
- console.log(
- `Error trying to go fullscreen: ${err.message} (${err.name})`,
- )
- })
- } else {
- document.exitFullscreen()
- }
+ if (!document.fullscreenElement) {
+ document.body.requestFullscreen().catch((err) => {
+ console.log(
+ `Error trying to go fullscreen: ${err.message} (${err.name})`,
+ )
+ })
+ } else {
+ document.exitFullscreen()
+ }
-