init audio and hurt sound

This commit is contained in:
neckrat 2025-11-11 16:26:20 +03:00
parent 59f1227033
commit 28b0384285
4 changed files with 5 additions and 0 deletions

Binary file not shown.

0
lib/audio.lua Normal file
View File

View File

@ -144,6 +144,7 @@ function attack:cast(caster, target)
AnimationNode { AnimationNode {
function(node) function(node)
targetSprite:animate("hurt", node) targetSprite:animate("hurt", node)
Tree.assets.files.audio.sounds.hurt:play()
end end
} }
} }

View File

@ -50,6 +50,10 @@ function AssetBundle.loadFile(path)
return love.graphics.newShader(path); return love.graphics.newShader(path);
elseif (ext == "lua") then elseif (ext == "lua") then
return require(string.gsub(path, ".lua", "")) return require(string.gsub(path, ".lua", ""))
elseif (ext == "mp3") and string.find(path, "sounds") then
return love.audio.newSource(path, 'static')
elseif (ext == "mp3") and string.find(path, "music") then
return love.audio.newSource(path, 'stream')
end end
return nil return nil
end end