Page 1 of 1

[Solved] Anim8, help regarding "getFrameInfo()" requested

Posted: Wed Jun 06, 2018 2:48 pm
by gubbengetze
Hi!

Image
Above image is a gif. I couldn't get it to animate. Please click to see my example illustrated

I have just added a whole lot of hats to my project by just drawing them on top of my sprites, but instead of animating each and every one of them to fit the player animation I want to move them accordingly by checking what frame the current animation is on. For example; if playerRunning_Animation is on frame 1 and 6 I want to move the hat up by 1 pixel and then down again.

Is this possible using Anim8?

I am trying to figure out how to use "getFrameInfo()" to determine this, but I can't seem to figure it out how I am supposed to use it. The documentation reads as follows:
`animation:getFrameInfo(x,y, r, sx, sy, ox, oy, kx, ky)`

This functions returns the parameters that would be passed to `love.graphics.draw` when drawing this animation:
`frame, x, y, r, sx, sy, ox, oy, kx, ky`.

* `frame` is the currently active frame for the animation (usually a quad produced by a grid)
How do I check which frame the animation is currently on? Please help a newbie out! :oops: :nyu:

Re: Anim8, help regarding "getFrameInfo()" requested

Posted: Wed Jun 06, 2018 8:06 pm
by KayleMaster
Try getting it from animation.position

Re: Anim8, help regarding "getFrameInfo()" requested

Posted: Wed Jun 06, 2018 9:11 pm
by gubbengetze
KayleMaster wrote: Wed Jun 06, 2018 8:06 pm Try getting it from animation.position
Thank you so much! I got hung up on the thought that it had to be through the getFrameInfo()-method after reading through the documentation, but this was really simple and worked great! Cheers! :ultraglee:

Re: [Solved] Anim8, help regarding "getFrameInfo()" requested

Posted: Thu Jun 07, 2018 8:09 am
by KayleMaster
Yeah, I had the same problem. There's actually no api to get the current frame so you have to make your own.
I just looked into the library's code, and since it's written by kikito, it's super easy to understand.
Personally I made a method that returns it, instead of directly accessing the table.