[Solved] Animations And Love bugged?

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
User avatar
shatterblast
Party member
Posts: 136
Joined: Tue Dec 11, 2012 9:47 pm
Location: Dallas, Texas, USA

[Solved] Animations And Love bugged?

Post 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?
Last edited by shatterblast on Sat Feb 02, 2013 6:59 pm, edited 1 time in total.
User avatar
shatterblast
Party member
Posts: 136
Joined: Tue Dec 11, 2012 9:47 pm
Location: Dallas, Texas, USA

Re: Animations And Love bugged?

Post 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.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Animations And Love bugged?

Post 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!)
User avatar
shatterblast
Party member
Posts: 136
Joined: Tue Dec 11, 2012 9:47 pm
Location: Dallas, Texas, USA

Re: Animations And Love bugged?

Post 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
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Animations And Love bugged?

Post by bartbes »

Well, yes, you're resetting every frame, of course you'll only see the first animation frame, what did you expect?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Animations And Love bugged?

Post 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.
When I write def I mean function.
User avatar
shatterblast
Party member
Posts: 136
Joined: Tue Dec 11, 2012 9:47 pm
Location: Dallas, Texas, USA

Re: Animations And Love bugged?

Post 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.
elrohir
Prole
Posts: 1
Joined: Mon Feb 04, 2013 8:01 am
Contact:

Re: [Solved] Animations And Love bugged?

Post by elrohir »

The animations I test with animation:reset() freeze at the first frame? Anywork, it works.
User avatar
shatterblast
Party member
Posts: 136
Joined: Tue Dec 11, 2012 9:47 pm
Location: Dallas, Texas, USA

Re: [Solved] Animations And Love bugged?

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

Who is online

Users browsing this forum: Bing [Bot] and 3 guests