summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthe lemons <citrons@mondecitronne.com>2022-08-27 02:49:01 -0500
committerthe lemons <citrons@mondecitronne.com>2022-08-27 02:49:01 -0500
commit0e89c14698023c50001fb820c82f2f59b0730b03 (patch)
treec965b10914f60610c5272debce4b5d5b8d8f5ff3
parentaf8be3bd7a056aa5f71f296e7d55d0938765a39b (diff)
do not fail silently when sprites do not exist
-rw-r--r--Sprite.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/Sprite.lua b/Sprite.lua
index dac5ce8..aa761ea 100644
--- a/Sprite.lua
+++ b/Sprite.lua
@@ -14,9 +14,7 @@ local function get_states(name)
loaded[name] = {}
local path = "sprite/"..name
- if love.filesystem.getInfo(path..".png", 'file') then
- loaded[name][name] = load_image(path..".png")
- elseif love.filesystem.getInfo(path, 'directory') then
+ if love.filesystem.getInfo(path, 'directory') then
local files = love.filesystem.getDirectoryItems(path)
for _, file in ipairs(files) do
local state = file:match '^(.*)%.png$'
@@ -24,6 +22,8 @@ local function get_states(name)
loaded[name][state] = load_image(path.."/"..file)
end
end
+ else
+ loaded[name][name] = load_image(path..".png")
end
return loaded[name]
end