That's fine. You could also submit a pull request to merge your change in vs having two separate repos for the same code. Or at the very least branch off mine. Not a big deal of course.
I have the same question as jmation. Wanting to basically perform an action when an animation has ended. I could hard-code a check against the last frame, knowing how long the animation is, but a :getEndFrame() would be amazing in addition to what's there.
Is there some other way of doing this I'm not thinking of?
Thank you so much for this, this is how I expect and hope animated images might work in the SDK proper in future Super easy to work with.
Thanks for this! I used it to add a simple animation to my title screen, a timer resets its index so it loops with a delay. Removed a decent chunk of setup code
Also just noticed how you're using getImage() in the sprite example. Though this works fine, you could also just pass in the animated image directly as it is designed to act as a proxy to the current frame's image, which is the whole point of the class: graphics.image but animated.
While you're here in the thread Dustin, I took your assertion above of "image but animated" literally and tried using it with :setImage() on a sprite, but no dice. Is getting it working with sprites via this method way outside the scope of this, or something viable in future?
I have zero idea how hard this is. Just wishing Playdate SDK had better built in stuff for handling animated sprites
Oh that makes sense now that I think of it. I suppose any part of the API where the lua object is handed off to C this may not work. It works when Lua code expects an image and calls image methods on the AnimatedImage object, but if it gets handed over via C and C is casting to a graphics.image object, this will probably.
Brought this into AnimatedImage. Also made it so you can simply pass in an image table if you have one already loaded—which you may if you are thinking about using the sequence param where you can now select individual frames from a larger image table.
You know, sometimes you think you're good enough to just write some code and commit without testing. Then the world slaps you in the face and says "NO."