Page 1 of 1

Problem with Animations

Posted: Thu Feb 01, 2018 2:19 am
by DiegoG
Hello, I've been working on a project for a while and just recently, while I was testing, I found a rather peculiar error in the animations handler I made -- It doesn't draw the image at all
I've checked all the relevant data I could think of, presence of assets, animation states, switching, quad switching (even checking their viewports) and everything flows just as it should, even the position. But for some reason the frames won't show up
I've compiled all the relevant files and made a small game with most of the same files, specially the same animation function, I've tested and it not only runs well but replicates the error seamlessly. I'd be very thankful if you could help me out with this! I've already gone ahead and set the love.graphics.print functions required to check the data I was viewing. Thanks in advance!
anim problem.love
(51.03 KiB) Downloaded 119 times

Re: Problem with Animations

Posted: Thu Feb 01, 2018 2:40 am
by zorg
In your assets.lua, you do this:

Code: Select all

lg.newQuad(x,y,w,h,0,0)
It will never draw anything like that, since you're basically saying that with an image of size 0x0 as reference, you define quads in that; you need to pass in the width and height of the image you want to apply the quad on as the reference width and height.

Code: Select all

-- also move your animObj.img definition above this part
table.insert(states[i],lg.newQuad(x,y,w,h,animObj.img:getDimensions))

Re: Problem with Animations

Posted: Thu Feb 01, 2018 6:50 pm
by DiegoG
Wow.
I'm a moron.

Thanks for your help though! Really appreciated :D
It works now!