diff --git a/assets/audio/sounds/hurt.mp3 b/assets/audio/sounds/hurt.mp3 new file mode 100644 index 0000000..8c6e1bc Binary files /dev/null and b/assets/audio/sounds/hurt.mp3 differ diff --git a/lib/audio.lua b/lib/audio.lua new file mode 100644 index 0000000..e69de29 diff --git a/lib/spellbook.lua b/lib/spellbook.lua index 3c831ad..2702b71 100644 --- a/lib/spellbook.lua +++ b/lib/spellbook.lua @@ -144,6 +144,7 @@ function attack:cast(caster, target) AnimationNode { function(node) targetSprite:animate("hurt", node) + Tree.assets.files.audio.sounds.hurt:play() end } } diff --git a/lib/utils/asset_bundle.lua b/lib/utils/asset_bundle.lua index da4692a..f831325 100644 --- a/lib/utils/asset_bundle.lua +++ b/lib/utils/asset_bundle.lua @@ -50,6 +50,10 @@ function AssetBundle.loadFile(path) return love.graphics.newShader(path); elseif (ext == "lua") then 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 return nil end