wobblyhead hg > minor_monsters
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 3:cc0c32e71090 | 4:2d46729a022e |
|---|---|
| 63 var m = target(t, game.monsters); | 63 var m = target(t, game.monsters); |
| 64 if (!m) return; | 64 if (!m) return; |
| 65 if (!melee) t.angle = Math.atan2(m.y - t.y, m.x - t.x); | 65 if (!melee) t.angle = Math.atan2(m.y - t.y, m.x - t.x); |
| 66 if (t.cooldown > 0) return; | 66 if (t.cooldown > 0) return; |
| 67 t.cooldown += t.def.attack_time; | 67 t.cooldown += t.def.attack_time; |
| 68 // sound events t0_attack for the melee tower, t1_shot and so on | |
| 69 MM.audio.play(t.type + (melee ? "_attack" : "_shot")); | |
| 68 if (melee) { | 70 if (melee) { |
| 69 // every monster in range at once | 71 // every monster in range at once |
| 70 var hit = game.monsters.filter(function (o) { return o.alive && inRange(t, o); }); | 72 var hit = game.monsters.filter(function (o) { return o.alive && inRange(t, o); }); |
| 71 hit.forEach(function (o) { game.damage(o, damage(t)); }); | 73 hit.forEach(function (o) { game.damage(o, damage(t)); }); |
| 72 t.burst = BURST_TIME; | 74 t.burst = BURST_TIME; |
