diff options
author | elioat <elioat@tilde.institute> | 2025-02-16 21:39:03 -0500 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2025-02-16 21:39:03 -0500 |
commit | 8e8ece41840f52ce1a91ae8b5ca3b0e7bba3dbb0 (patch) | |
tree | 2d54f8bfd32db39ba204c6f1dbc6280e47594374 /html/tower/js/mechanics.js | |
parent | d2e04d40c8dcde7ee647d328eed3c3da35cd469e (diff) | |
download | tour-8e8ece41840f52ce1a91ae8b5ca3b0e7bba3dbb0.tar.gz |
*
Diffstat (limited to 'html/tower/js/mechanics.js')
-rw-r--r-- | html/tower/js/mechanics.js | 8 |
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, |