diff options
| author | Eltrac <hi@guhub.cn> | 2025-03-12 23:26:52 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-03-12 23:26:52 +0800 |
| commit | 93be21bd9694287397c96f0cf93c9565d53b6d61 (patch) | |
| tree | 06840f96ad84101d2a5ab2fec2eaf38423d4a96d /logic/controller.lua | |
| parent | 33cf1a9f7fe9a87923db11f8d1e2a7cf756a690a (diff) | |
feat(audio): play projectile sound when player shoots
Diffstat (limited to 'logic/controller.lua')
| -rw-r--r-- | logic/controller.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/logic/controller.lua b/logic/controller.lua index d0cfb72..0a45dee 100644 --- a/logic/controller.lua +++ b/logic/controller.lua @@ -1,4 +1,5 @@ require "data.directions" +local audio = require "utils.audio" local controller = {} @@ -37,11 +38,14 @@ end local function playerClickMouseToShoot(dt) if love.mouse.isDown(1) then if G.player:ammoCooling() then return end + local target = { x = love.mouse.getX(), y = love.mouse.getY() } - G.player:shoot(target) + if G.player:shoot(target) then + audio.play("projectile") + end else -- if player stopped pressing mouse -- reset charging timer |
