I like how easy to use the Animation loop is when using an imagetable.
When I have an animation that repeats the same frame, I don't want to have to keep repeating the same image in the imagetable, so that if I change my artwork I only have to update one image.
Suppose that my animation uses frames A,B,A,C,A,D. I'd like be able to use an imagetable with only four frames A,B,C,D and tell the animator to use indices 1,2,1,3,1,4 of my imagetable.
This would also let me use one imagetable that includes the frames for many different sprites, so that I can define animation loops using frames 3,6,9 of the image table.
Meanwhile you could use Dustin's AnimatedImage to achieve this. GitHub - mierau/playdate-animatedimage: A dead simple and lightweight way to display animated images/gifs in your Playdate game.
Or you could code yourself a small function to iterate the frames in the order you've described with/without using an animator.
Or you could keep track of the frames outside of the code and at build time generate the full image table using your minimal number of frames. (This would be my choice)
Hi Matt, thanks for the reply.
Your third option sounds neat. My current project is too small to need to implement it, but this sounds like a nice way to go to separate the animations from the code.
To do this at build time do you recommend that I write my own "builder" script that does whatever I need and then calls the playdate compiler:
How? Whatever way works for you.
When I first did it for Daily Driver I started with a simple shell script that I attached to the build command in Nova text editor.
A while later I progressed to a Makefile that built (in my case rendering 3D to 2D, resizing, and reducing to 1-bit) only files that had changed since the last build.
For your purposes it could be as simple as a one line ImageMagick command:
magick A.png B.png A.png C.png A.png D.png +append sprite-table-12-34.png
(you can use
-append if you have a preference for vertical stacking)
Awesome. Thanks for all the suggestions, I'll give it a go.
Feel free to report back or ask if you want to do something crazy in the build process.