about summary refs log tree commit diff stats
path: root/html/tower/js/game.js
diff options
context:
space:
mode:
Diffstat (limited to 'html/tower/js/game.js')
-rw-r--r--html/tower/js/game.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/html/tower/js/game.js b/html/tower/js/game.js
index 5c28f31..7d362ae 100644
--- a/html/tower/js/game.js
+++ b/html/tower/js/game.js
@@ -43,6 +43,8 @@ function handleCombatPhase(timestamp, deltaTime) {
     gameState.projectiles = gameState.projectiles.filter(p => timestamp - p.createdAt < p.lifetime);
     
     const cellSize = canvas.width / 20;
+    
+    // Process tower and enemy attacks
     processTowerAttacks(
         gameState.towers,
         gameState.enemies,
@@ -52,7 +54,17 @@ function handleCombatPhase(timestamp, deltaTime) {
         cellSize
     );
     
+    processEnemyAttacks(
+        gameState.enemies,
+        gameState.towers,
+        gameState.particles,
+        timestamp,
+        cellSize
+    );
+    
+    // Remove dead enemies and destroyed towers
     gameState.enemies = gameState.enemies.filter(enemy => enemy.currentHealth > 0);
+    gameState.towers = gameState.towers.filter(tower => tower.currentHealth > 0);
 }
 
 function spawnEnemies(timestamp) {