Hi! I would like to make a simple garbage-collecting function because a lot of times I just remove sprites from the draw list and move on, but after some time the memory has loaded up with a ton of sprites removed from the draw list, but still existing in memory. After running the "playdate.graphics.sprite.getAllSprites" function, I want to check which one of the sprites is removed from the draw list and to get rid of that sprite from the memory.
If I wasn't understandable, which I would totally get, here's the current function:
function collectSpriteGarbage()
for k, v in ipairs(playdate.graphics.sprite.getAllSprites()) do
-- check if sprite is removed
-- delete sprite from memory
end
end