Update: I think I've figured out how it works and I'm gonna leave a quick ELI5 for anyone else trying to do the same by explaining how I did it
-
Place animateObject.lua (download in this post) in your mod folder.
-
Use SMODS.load_file('animateObject.lua)()' in your main mod lua file to load the extra file. make sure you do this above where you define the jokers you want to animate so it gets loaded properly.
-
use the function AddRunningAnimation() in your joker definition (SMODS.joker{}) to animate it. You will still have to define atlas and pos like normal. Make sure atlas is an atlas that contains every frame of your animation, left to right, top to bottom.
3.5) the correct setup for AddRunningAnimation() is AddRunningAnimation({'j_(your mod prefix here)_(your joker key here), (time between frames), (number of frames across your atlas is minus one), (ditto but for height instead of across), (type of animation (usually loop)), 0, 0, card})
3.5.5) Note: the length and height code works by the same logic as pos = {} does, which is why the lengths have to be subtracted by one.
-
Overall if done correctly it should be structured like this:
--- PREFIX: example_prefix
...
SMODS.load_file('animateObject.lua')()
...
SMODS.Atlas{ --atlas for your animated texture, should contain all frames of your animation
key = 'animatedjokeratlas',
path = 'animatedjokeratlas.png',
px = 71,
py = 95
}
...
SMODS.Joker{
key = 'myanimatedjoker',
...
atlas = 'animatedjokeratlas',
pos = {x = 0, y = 0) --the first frame of the animation. the animation will run to the right until reaching the defined length, then go back to the left and down one, repeat until hitting the end of the defined height.
AddRunningAnimation({'j_example_prefix_myanimatedjoker',0.125,5,5,'loop',0,0,card}),
This doesn't include everything but it should be enough for anyone to make it work, hopefully.