I can't create animation loops any longer as playdate.graphics.animation.loop.new isn't happy with anything I pass to it anymore.
Most of my animations are from images written to disk and pulled into imagetables like this:
local imageTable = playdate.graphics.imagetable.new(path)
local loop = playdate.graphics.animation.loop.new(delay, imageTable, true)
I also like to create animation loops dynamically, sort of like this:
local imageTable = playdate.graphics.imagetable.new(frameCount)
for i = 1, frameCount do
local image = playdate.graphics.image.new(w, h, clear)
-- draw something on the image using lockFocus(), unlockFocus()
imageTable:setImage(i, image)
end
local loop = playdate.graphics.animation.loop.new(delay, imageTable, true)
Here is the error:
CoreLibs/animation.lua:134: playdate.graphics.animation.loop.new(): imageTable
argument must be a playdate.graphics.imagetable
stack traceback:
[C]: in function 'assert'
CoreLibs/animation.lua:134: in field 'new'
Commenting out animation.lua line 134 allows my app to build and run as expected with working animations. I even tried something like setmetatable() before calling loop.new() but that didn't work. Lua is new to me and I'm still unclear on why, when for setmetatable, getmetatable.
Before I discovered animation.loop.new() I had written my own solution but it didn't offer a configurable delay, which is a really nice feature.
I looked in the Examples folder in the SDK but nothing there uses playdate.graphics.animation.loop.new().
I hope I've explained the issue well.