diff options
author | the lemons <citrons@mondecitronne.com> | 2022-08-27 02:49:01 -0500 |
---|---|---|
committer | the lemons <citrons@mondecitronne.com> | 2022-08-27 02:49:01 -0500 |
commit | 0e89c14698023c50001fb820c82f2f59b0730b03 (patch) | |
tree | c965b10914f60610c5272debce4b5d5b8d8f5ff3 | |
parent | af8be3bd7a056aa5f71f296e7d55d0938765a39b (diff) |
do not fail silently when sprites do not exist
-rw-r--r-- | Sprite.lua | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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 |