From 0e89c14698023c50001fb820c82f2f59b0730b03 Mon Sep 17 00:00:00 2001 From: the lemons Date: Sat, 27 Aug 2022 02:49:01 -0500 Subject: do not fail silently when sprites do not exist --- Sprite.lua | 6 +++--- 1 file 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 -- cgit v1.2.3