From 93be21bd9694287397c96f0cf93c9565d53b6d61 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Wed, 12 Mar 2025 23:26:52 +0800 Subject: feat(audio): play projectile sound when player shoots --- logic/controller.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'logic/controller.lua') 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 -- cgit v1.2.3