Trouble With Anim8

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
drikdrok
Prole
Posts: 36
Joined: Sun Mar 15, 2015 9:53 am
Contact:

Trouble With Anim8

Post by drikdrok »

So I am trying to do a small animation in a test game. But i can't get Anim8 to work. I get a: "There is no frame for x = 0, y = 0"
Here is my code:

Code: Select all

function love.load()
image = love.graphics.newImage("assets/animations/Animation.png")
local g = anim8.newGrid(32, 32, image:getWidth(), image:getHeight())
animation = anim8.newAnimation(g('1-8', 1), 0.1)
end

function love.update(dt)
animation:update(dt)
end

function love.draw()
animation:draw(image, 100, 200)
end
I have copied the code from the Anim8 wiki, and i just can't get it to work... An answer would be appreciated :)
Note: If you were to look at the full Source that the code is very messy. I am just trying to make it work, nothing else.
Attachments
Game.love
(374.38 KiB) Downloaded 71 times
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Trouble With Anim8

Post by bartbes »

Probably because your animation file is 62x30, which means there is not a single 32x32 subimage contained within. If I modify the size to 20x30, which seems to be the size of your frames, specify there's a 1-pixel padding and reduce the number of frames to 3, it works fine.
User avatar
drikdrok
Prole
Posts: 36
Joined: Sun Mar 15, 2015 9:53 am
Contact:

Re: Trouble With Anim8

Post by drikdrok »

bartbes wrote:Probably because your animation file is 62x30, which means there is not a single 32x32 subimage contained within. If I modify the size to 20x30, which seems to be the size of your frames, specify there's a 1-pixel padding and reduce the number of frames to 3, it works fine.
Yes, i actually figured this out before the post was verified. But thanks anyways :D!
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests