Page 1 of 1

Animation

Posted: Sat Sep 25, 2010 2:25 am
by Kevin Tillman
Hi all, I have searched the forums on animating my spritesheet with the new version of love. How is animation being handled? I remember in the old version that I used, there was a call to love.graphics.newAnimation(). Is animation now being handled by the SpriteBatch? Im anxious to continue working on my action rpg XD.


Thanks all

Re: Animation

Posted: Sat Sep 25, 2010 2:51 am
by TechnoCat

Re: Animation

Posted: Sat Sep 25, 2010 3:08 am
by Kevin Tillman
thanks TechnoCat

Re: Animation

Posted: Sat Sep 25, 2010 3:34 am
by Kevin Tillman
the link to animation.Lua is broken, so what to do?

nvm got it working

Re: Animation

Posted: Mon Sep 27, 2010 1:17 pm
by zac352
Kevin Tillman wrote:Hi all, I have searched the forums on animating my spritesheet with the new version of love. How is animation being handled? I remember in the old version that I used, there was a call to love.graphics.newAnimation(). Is animation now being handled by the SpriteBatch? Im anxious to continue working on my action rpg XD.


Thanks all

Code: Select all

images={"img1.png","img2.png","img3.png"}
local i={}
for _,v in pairs(images) do
table.insert(i,love.graphics.newImage(v))
end
function drawanim(x,y,rot,sx,sy,ox,oy)
local t=math.floor((love.timer.getTime()*1000/(1/#images))%#images)
love.graphics.draw(i[t],x,y,rot,sx,sy,ox,oy)
end
Is this what you're looking for? :P