about summary refs log tree commit diff stats
path: root/html/tower/js/mechanics.js
diff options
context:
space:
mode:
authorelioat <elioat@tilde.institute>2025-02-16 21:39:03 -0500
committerelioat <elioat@tilde.institute>2025-02-16 21:39:03 -0500
commit8e8ece41840f52ce1a91ae8b5ca3b0e7bba3dbb0 (patch)
tree2d54f8bfd32db39ba204c6f1dbc6280e47594374 /html/tower/js/mechanics.js
parentd2e04d40c8dcde7ee647d328eed3c3da35cd469e (diff)
downloadtour-8e8ece41840f52ce1a91ae8b5ca3b0e7bba3dbb0.tar.gz
*
Diffstat (limited to 'html/tower/js/mechanics.js')
-rw-r--r--html/tower/js/mechanics.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/html/tower/js/mechanics.js b/html/tower/js/mechanics.js
index f2ec57b..13b3ce8 100644
--- a/html/tower/js/mechanics.js
+++ b/html/tower/js/mechanics.js
@@ -153,6 +153,14 @@ function createSlimeTrail(enemy, cellSize) {
 }
 
 function handleTowerAttack(tower, target, projectiles, particles, timestamp, cellSize) {
+    // Check if tower has ammo
+    if (tower.ammo <= 0) {
+        return;
+    }
+    
+    // Decrease ammo
+    tower.ammo--;
+    
     projectiles.push({
         startPos: tower.position,
         targetPos: target.position,