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

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
gubbengetze
Prole
Posts: 3
Joined: Thu May 10, 2018 9:06 pm

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

Post 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:
Last edited by gubbengetze on Wed Jun 06, 2018 9:12 pm, edited 1 time in total.
KayleMaster
Party member
Posts: 234
Joined: Mon Aug 29, 2016 8:51 am

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

Post by KayleMaster »

Try getting it from animation.position
gubbengetze
Prole
Posts: 3
Joined: Thu May 10, 2018 9:06 pm

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

Post 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:
KayleMaster
Party member
Posts: 234
Joined: Mon Aug 29, 2016 8:51 am

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

Post 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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 6 guests