diff game/js/tower.js @ 4:2d46729a022e

sound processing and in-game sounds
author ark
date 2026-10-18 20:58 +0200
parents 5492efd60e2c
children 910b26feca76
line wrap: on
line diff
--- a/game/js/tower.js	Sun Oct 18 20:09:40 2026 +0200
+++ b/game/js/tower.js	Sun Oct 18 20:58:33 2026 +0200
@@ -65,6 +65,8 @@
         if (!melee) t.angle = Math.atan2(m.y - t.y, m.x - t.x);
         if (t.cooldown > 0) return;
         t.cooldown += t.def.attack_time;
+        // sound events t0_attack for the melee tower, t1_shot and so on
+        MM.audio.play(t.type + (melee ? "_attack" : "_shot"));
         if (melee) {
             // every monster in range at once
             var hit = game.monsters.filter(function (o) { return o.alive && inRange(t, o); });