Page 1 of 1
[Solved] Animations And Love bugged?
Posted: Fri Feb 01, 2013 10:08 am
by shatterblast
I've tried using animation:reset() with 0.80 of Love, but it just keeps feeding back error messages. I figure at the moment that I can just try another library. Can someone else confirm this, and how should I respond?
Re: Animations And Love bugged?
Posted: Fri Feb 01, 2013 6:21 pm
by shatterblast
Yeah, I'm pretty sure part of ANaL has broke since the Love 0.80 update. The same issues appear in this thread:
http://love2d.org/forums/viewtopic.php? ... nal#p32742
I can't get anim8 to work for me. Can someone please suggest an alternative for animations? I guess I could try to set up my own functions.
Re: Animations And Love bugged?
Posted: Fri Feb 01, 2013 8:17 pm
by bartbes
You do realize that those things happened in 2011, and have since long been fixed?
Can you at least post the errors, some code, anything at all? (Don't say it's unreasonable of me to ask, the forum guidelines tell you to do this to begin with!)
Re: Animations And Love bugged?
Posted: Sat Feb 02, 2013 2:02 am
by shatterblast
I suppose I must first apologize. I was using an outdated version of anal.lua. I re-downloaded the version of anal.lua from the Wiki, and now the crashing has stopped.
However, it leads to another problem. The animations I test with animation:reset() freeze at the first frame. I don't know if this is because of my operating system or what. (I'm using Ubuntu Linux 12.04 with a Pentium 4 processor, 3 gigs of memory, and an nVidia graphics card.) I haven't tested with Love 0.72 to know the difference.
Anyhow, here's my present code from main.lua and test files to show how the :reset() works with my testing. Maybe I'm just using :reset() wrong. I don't know.
Code: Select all
function love.load()
require("anal")
spritesheet = love.graphics.newImage("sparkle_test.png")
spritesheet:setFilter("nearest", "nearest")
animation = newAnimation(spritesheet, 192, 192, 0.1, 111)
--______________________________________________________________________
spritesheet2 = love.graphics.newImage("healing_circle.png")
spritesheet2:setFilter("nearest", "nearest")
animation2 = newAnimation(spritesheet2, 192, 192, 0.1, 47)
--______________________________________________________________________
animationState = "Effect_1"
end
function love.update(dt)
animation:update(dt)
animation2:update(dt)
end
function love.draw()
love.graphics.print("Press 1 or 2 to alternate between animations.", 50, 50)
love.graphics.print(animationState, 50, 80)
if animationState == "Effect_1" then
animation:setMode("loop")
animation:draw(200, 200)
animation:reset() -- <--- Here I have the trouble. <---
elseif animationState == "Effect_2" then
animation2:setMode("loop")
animation2:draw(200, 200)
animation2:reset() -- <--- Here I have the trouble. <---
end
end
function love.keypressed(key)
if key == "1" then
animationState = "Effect_1"
elseif key == "2" then
animationState = "Effect_2"
end
end
Re: Animations And Love bugged?
Posted: Sat Feb 02, 2013 11:28 am
by bartbes
Well, yes, you're resetting every frame, of course you'll only see the first animation frame, what did you expect?
Re: Animations And Love bugged?
Posted: Sat Feb 02, 2013 12:34 pm
by kikito
shatterblast wrote:I can't get anim8 to work for me.
This is probably my fault. I somehow missed
your question in the anim8 thread. I've
just answered, in case you still want to give it a try.
Re: Animations And Love bugged?
Posted: Sat Feb 02, 2013 6:55 pm
by shatterblast
bartbes wrote:Well, yes, you're resetting every frame, of course you'll only see the first animation frame, what did you expect?
I was assuming it would reset only once. I guess I'll go back and make a function that tests what frame is currently playing, and then reset at that point.
kikito wrote:shatterblast wrote:I can't get anim8 to work for me.
This is probably my fault. I somehow missed
your question in the anim8 thread. I've
just answered, in case you still want to give it a try.
I'd like to try at a later date. Thank you. I would still like to give it a try.
Thanks to both of you for answering me. It gives me some things to figure out.
Re: [Solved] Animations And Love bugged?
Posted: Mon Feb 04, 2013 8:15 am
by elrohir
The animations I test with animation:reset() freeze at the first frame? Anywork, it works.
Re: [Solved] Animations And Love bugged?
Posted: Mon Feb 04, 2013 5:57 pm
by shatterblast
Here is the final working code for anyone who might find it useful. Instead of looping, it now only plays once per animation load and resets at the press of key 1 or 2. (Not the number pad.)
The first animation is a little scruffy, but it's just for testing purposes anyhow.
main.lua :
Code: Select all
function love.load()
require("anal")
spritesheet = love.graphics.newImage("sparkle_test.png")
spritesheet:setFilter("nearest", "nearest")
animation = newAnimation(spritesheet, 192, 192, 0.1, 110)
--______________________________________________________________________
spritesheet2 = love.graphics.newImage("healing_circle.png")
spritesheet2:setFilter("nearest", "nearest")
animation2 = newAnimation(spritesheet2, 192, 192, 0.1, 50)
--______________________________________________________________________
animationState = "Effect_1"
end
function love.update(dt)
animation:update(dt)
animation2:update(dt)
end
function love.draw()
love.graphics.print("Press 1 or 2 to alternate between animations.", 50, 50)
love.graphics.print(animationState, 50, 80)
if animationState == "Effect_1" then
animation:setMode("once")
animation:draw(200, 200)
elseif animationState == "Effect_2" then
animation2:setMode("once")
animation2:draw(200, 200)
end
end
function love.keypressed(key)
if key == "1" then
animationState = "Effect_1"
animation:reset()
animation:play()
elseif key == "2" then
animationState = "Effect_2"
animation2:reset()
animation2:play()
end
end